demacroize ncplot_destroy() #1976

pull/1978/head
nick black 3 years ago committed by nick black
parent 6f55338983
commit a69753dac4

@ -77,7 +77,7 @@ endif()
# global compiler flags
add_compile_definitions(_FORTIFY_SOURCE=2)
add_compile_options(-Wall -Wextra -W -Wshadow -Wformat -Wformat-security
-fexceptions -fstrict-aliasing)
-fexceptions -fstrict-aliasing -fanalyzer)
message(STATUS "Requested multimedia engine: ${USE_MULTIMEDIA}")
message(STATUS "Requested build mode: ${CMAKE_BUILD_TYPE}")

@ -373,16 +373,17 @@ int sample_##T(const nc##X##plot* ncp, int64_t x, T* y){ \
} \
*y = ncp->slots[x % ncp->plot.slotcount]; \
return 0; \
} \
void destroy_##T(nc##X##plot* ncpp){ \
free(ncpp->plot.title); \
free(ncpp->slots); \
ncplane_destroy(ncpp->plot.ncp); \
}
CREATE(uint64_t, u)
CREATE(double, d)
static void
ncplot_destroy(ncplot* n){
free(n->title);
ncplane_destroy(n->ncp);
}
/* if we're doing domain detection, update the domain to reflect the value we
just set. if we're not, check the result against the known ranges, and
return -1 if the value is outside of that range. */
@ -484,7 +485,8 @@ int ncuplot_set_sample(ncuplot* n, uint64_t x, uint64_t y){
void ncuplot_destroy(ncuplot* n){
if(n){
destroy_uint64_t(n);
ncplot_destroy(&n->plot);
free(n->slots);
free(n);
}
}
@ -533,7 +535,8 @@ int ncdplot_sample(const ncdplot* n, uint64_t x, double* y){
void ncdplot_destroy(ncdplot* n) {
if(n){
destroy_double(n);
ncplot_destroy(&n->plot);
free(n->slots);
free(n);
}
}

Loading…
Cancel
Save