diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-12-10 15:15:33 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-12-10 15:15:33 -0500 |
commit | 5e14db43b7212b52f1cfcd2b0fce41df7fc419eb (patch) | |
tree | 1ae34085634983b89f972101f51785ce4d7ff30b /src/configfile-glue.c | |
parent | abf470bebe446db762e01d04e894691390da7d45 (diff) | |
download | lighttpd-git-5e14db43b7212b52f1cfcd2b0fce41df7fc419eb.tar.gz |
[multiple] employ ck_calloc, ck_malloc shared code
employ ck_calloc(), ck_malloc() shared code to slightly reduce code size
(centralize the ck_assert() to check that memory allocation succeeded)
Diffstat (limited to 'src/configfile-glue.c')
-rw-r--r-- | src/configfile-glue.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/configfile-glue.c b/src/configfile-glue.c index 4b2d8c15..a22b932c 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -344,8 +344,7 @@ int config_plugin_values_init(server * const srv, void *p_d, const config_plugin /*(+1 to include global scope, whether or not any directives exist)*/ /*(+n for extra element to end each list)*/ p->cvlist = (config_plugin_value_t *) - calloc(1+n+n+elts, sizeof(config_plugin_value_t)); - force_assert(p->cvlist); + ck_calloc(1+n+n+elts, sizeof(config_plugin_value_t)); elts = 1+n; /* shift past first element if no directives in global scope */ @@ -714,8 +713,7 @@ static int config_pcre_match(request_st * const r, const data_config * const dc, r->cond_match[capture_offset] = r->cond_match_data + capture_offset; if (__builtin_expect( (NULL == cond_match->matches), 0)) { /*(allocate on demand)*/ - cond_match->matches = malloc(dc->ovec_nelts * sizeof(int)); - force_assert(cond_match->matches); + cond_match->matches = ck_malloc(dc->ovec_nelts * sizeof(int)); } cond_match->comp_value = b; /*holds pointer to b (!) for pattern subst*/ cond_match->captures = |