diff --git a/doc/release-checklist.md b/doc/release-checklist.md index 7ce28ac0a..01fb1ece7 100644 --- a/doc/release-checklist.md +++ b/doc/release-checklist.md @@ -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 diff --git a/src/lib/cpp.h b/src/lib/cpp.h index d287fa7be..ce8d22355 100644 --- a/src/lib/cpp.h +++ b/src/lib/cpp.h @@ -29,21 +29,21 @@ class ncppplot { static bool create(ncppplot* 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; diff --git a/src/lib/plot.cpp b/src/lib/plot.cpp index 7a296f121..de7e83260 100644 --- a/src/lib/plot.cpp +++ b/src/lib/plot.cpp @@ -1,69 +1,69 @@ #include "cpp.h" -typedef struct ncuplot { +using ncuplot = struct ncuplot { ncppplot n; -} ncuplot; +}; -typedef struct ncdplot { +using ncdplot = struct ncdplot { ncppplot n; -} ncdplot; +}; extern "C" { -ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy){ +ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy) { auto ret = new ncuplot; if(ret){ if(ncppplot::create(&ret->n, n, opts, miny, maxy)){ return ret; } - free(ret); + delete ret; } return nullptr; } -ncplane* ncuplot_plane(ncuplot* n){ +ncplane* ncuplot_plane(ncuplot* n) { return n->n.ncp; } -int ncuplot_add_sample(ncuplot* n, uint64_t x, uint64_t y){ +int ncuplot_add_sample(ncuplot* n, uint64_t x, uint64_t y) { return n->n.add_sample(x, y); } -int ncuplot_set_sample(ncuplot* n, uint64_t x, uint64_t y){ +int ncuplot_set_sample(ncuplot* n, uint64_t x, uint64_t y) { return n->n.set_sample(x, y); } -void ncuplot_destroy(ncuplot* n){ +void ncuplot_destroy(ncuplot* n) { if(n){ n->n.destroy(); delete n; } } -ncdplot* ncdplot_create(ncplane* n, const ncplot_options* opts, double miny, double maxy){ +ncdplot* ncdplot_create(ncplane* n, const ncplot_options* opts, double miny, double maxy) { auto ret = new ncdplot; if(ret){ if(ncppplot::create(&ret->n, n, opts, miny, maxy)){ return ret; } - free(ret); + delete ret; } return nullptr; } -ncplane* ncdplot_plane(ncdplot* n){ +ncplane* ncdplot_plane(ncdplot* n) { return n->n.ncp; } -int ncdplot_add_sample(ncdplot* n, uint64_t x, double y){ +int ncdplot_add_sample(ncdplot* n, uint64_t x, double y) { return n->n.add_sample(x, y); } -int ncdplot_set_sample(ncdplot* n, uint64_t x, double y){ +int ncdplot_set_sample(ncdplot* n, uint64_t x, double y) { return n->n.set_sample(x, y); } -void ncdplot_destroy(ncdplot* n){ +void ncdplot_destroy(ncdplot* n) { if(n){ n->n.destroy(); delete n; diff --git a/tests/zaxis.cpp b/tests/zaxis.cpp index a4fafd7cc..4f72cf3f0 100644 --- a/tests/zaxis.cpp +++ b/tests/zaxis.cpp @@ -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_);