diff --git a/src/lib/fd.c b/src/lib/fd.c index 6a4f957a5..21da3622f 100644 --- a/src/lib/fd.c +++ b/src/lib/fd.c @@ -126,6 +126,10 @@ ncfdplane_create_internal(ncplane* n, const ncfdplane_options* opts, int fd, ncfdplane* ncfdplane_create(ncplane* n, const ncfdplane_options* opts, int fd, ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn){ + ncfdplane_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(fd < 0 || !cbfxn || !donecbfxn){ return NULL; } @@ -290,6 +294,10 @@ ncsubproc_launch(ncplane* n, ncsubproc* ret, const ncsubproc_options* opts, int ncsubproc* ncsubproc_createv(ncplane* n, const ncsubproc_options* opts, const char* bin, char* const arg[], ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn){ + ncsubproc_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(!cbfxn || !donecbfxn){ return NULL; } @@ -321,6 +329,10 @@ ncsubproc* ncsubproc_createv(ncplane* n, const ncsubproc_options* opts, ncsubproc* ncsubproc_createvp(ncplane* n, const ncsubproc_options* opts, const char* bin, char* const arg[], ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn){ + ncsubproc_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(!cbfxn || !donecbfxn){ return NULL; } @@ -352,6 +364,10 @@ ncsubproc* ncsubproc_createvp(ncplane* n, const ncsubproc_options* opts, ncsubproc* ncsubproc_createvpe(ncplane* n, const ncsubproc_options* opts, const char* bin, char* const arg[], char* const env[], ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn){ + ncsubproc_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(!cbfxn || !donecbfxn){ return NULL; } diff --git a/src/lib/menu.c b/src/lib/menu.c index 08212ee6c..46dea497e 100644 --- a/src/lib/menu.c +++ b/src/lib/menu.c @@ -287,6 +287,10 @@ write_header(ncmenu* ncm){ ncm->ncp->channels = ncm->headerchannels; } ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){ + ncmenu_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(opts->sectioncount <= 0 || !opts->sections){ return NULL; } diff --git a/src/lib/plot.h b/src/lib/plot.h index fd89ad65c..88a50c008 100644 --- a/src/lib/plot.h +++ b/src/lib/plot.h @@ -16,6 +16,10 @@ class ncppplot { // ought admit nullptr opts FIXME // reenable logging once #703 is done static bool create(ncppplot* ncpp, ncplane* n, const ncplot_options* opts, T miny, T maxy) { + ncplot_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(opts->flags > NCPLOT_OPTION_DETECTMAXONLY){ logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags); } diff --git a/src/lib/reader.c b/src/lib/reader.c index 1e8d6aa0e..68163505c 100644 --- a/src/lib/reader.c +++ b/src/lib/reader.c @@ -1,6 +1,10 @@ #include "internal.h" ncreader* ncreader_create(ncplane* n, int y, int x, const ncreader_options* opts){ + ncreader_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(opts->physrows <= 0 || opts->physcols <= 0){ logerror(n->nc, "Provided illegal geometry %dx%d\n", opts->physcols, opts->physrows); return NULL; diff --git a/src/lib/reel.c b/src/lib/reel.c index 38fe2b608..9f57c0d3d 100644 --- a/src/lib/reel.c +++ b/src/lib/reel.c @@ -719,8 +719,11 @@ ncplane* ncreel_plane(ncreel* nr){ } ncreel* ncreel_create(ncplane* n, const ncreel_options* ropts){ + ncreel_options zeroed = {}; ncreel* nr; - + if(!ropts){ + ropts = &zeroed; + } if(!validate_ncreel_opts(n, ropts)){ return NULL; } diff --git a/src/lib/selector.c b/src/lib/selector.c index 040e1f71d..a66a9bbae 100644 --- a/src/lib/selector.c +++ b/src/lib/selector.c @@ -217,6 +217,10 @@ ncselector_dim_yx(notcurses* nc, const ncselector* n, int* ncdimy, int* ncdimx){ } ncselector* ncselector_create(ncplane* n, int y, int x, const ncselector_options* opts){ + ncselector_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } unsigned itemcount = 0; if(opts->flags > 0){ logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags); @@ -799,6 +803,10 @@ ncmultiselector_dim_yx(notcurses* nc, const ncmultiselector* n, int* ncdimy, int ncmultiselector* ncmultiselector_create(ncplane* n, int y, int x, const ncmultiselector_options* opts){ + ncmultiselector_options zeroed = {}; + if(!opts){ + opts = &zeroed; + } if(opts->flags > 0){ logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags); }