plot: match delete, not free, with new

pull/555/head
nick black 4 years ago
parent 6a774afb27
commit e156bd42be
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,3 +1,5 @@
* clang-tidy check:
* `cmake "-DCMAKE_CXX_CLANG_TIDY=/usr/bin/clang-tidy-9;-checks=*" ..`
* Run tools/release.sh $OLDVERSION $VERSION
* Finalize CHANGELOG.md
* Bumps version numbers everywhere they need bumping

@ -29,21 +29,21 @@ class ncppplot {
static bool create(ncppplot<T>* ncpp, ncplane* n, const ncplot_options* opts, T miny, T maxy){
// if miny == maxy, they both must be equal to 0
if(miny == maxy && miny){
return NULL;
return false;
}
if(opts->rangex < 0){
return NULL;
return false;
}
if(maxy < miny){
return NULL;
return false;
}
if(opts->gridtype < 0 || opts->gridtype >= sizeof(geomdata) / sizeof(*geomdata)){
return NULL;
return false;
}
int sdimy, sdimx;
ncplane_dim_yx(n, &sdimy, &sdimx);
if(sdimx <= 0){
return NULL;
return false;
}
int dimx = sdimx;
ncpp->rangex = opts->rangex;

@ -1,12 +1,12 @@
#include "cpp.h"
typedef struct ncuplot {
using ncuplot = struct ncuplot {
ncppplot<uint64_t> n;
} ncuplot;
};
typedef struct ncdplot {
using ncdplot = struct ncdplot {
ncppplot<double> n;
} ncdplot;
};
extern "C" {
@ -16,7 +16,7 @@ ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, u
if(ncppplot<uint64_t>::create(&ret->n, n, opts, miny, maxy)){
return ret;
}
free(ret);
delete ret;
}
return nullptr;
}
@ -46,7 +46,7 @@ ncdplot* ncdplot_create(ncplane* n, const ncplot_options* opts, double miny, dou
if(ncppplot<double>::create(&ret->n, n, opts, miny, maxy)){
return ret;
}
free(ret);
delete ret;
}
return nullptr;
}

@ -9,7 +9,7 @@ TEST_CASE("ZAxisTest") {
notcurses_options nopts{};
nopts.inhibit_alternate_screen = true;
nopts.suppress_banner = true;
FILE* outfp_ = fopen("/dev/tty", "wb");
FILE* outfp_ = fopen("/dev/tty", "wbe");
REQUIRE(outfp_);
struct notcurses* nc_ = notcurses_init(&nopts, outfp_);
REQUIRE(nc_);

Loading…
Cancel
Save