From b4ececfc649ba051ccffe1029637f7262a59d8a0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 7 Oct 2014 20:36:17 +0100 Subject: [PATCH] NEW etc.: Use NEW_ARY Replace all calls to safe_malloc_ary with the NEW_ARY wrapper. Signed-off-by: Ian Jackson --- conffile.c | 2 +- ipaddr.c | 2 +- netlink.c | 3 +-- site.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conffile.c b/conffile.c index 3ffbd9f..84f4960 100644 --- a/conffile.c +++ b/conffile.c @@ -705,7 +705,7 @@ const char **dict_read_string_array(dict_t *dict, cstring_t key, } int32_t ll=list_length(l); - ra=safe_malloc_ary(sizeof(*ra), ll+1, "dict_read_string_array"); + NEW_ARY(ra, ll+1); for (rap=ra; l; l=l->next,rap++) { item_t *it=l->item; if (it->type!=t_string) diff --git a/ipaddr.c b/ipaddr.c index b3cd0a7..8bb2efc 100644 --- a/ipaddr.c +++ b/ipaddr.c @@ -18,7 +18,7 @@ struct subnet_list *subnet_list_new(void) NEW(r); r->entries=0; r->alloc=DEFAULT_ALLOC; - r->list=safe_malloc_ary(sizeof(*r->list),r->alloc,"subnet_list_new:data"); + NEW_ARY(r->list,r->alloc); return r; } diff --git a/netlink.c b/netlink.c index e180b1d..75763cf 100644 --- a/netlink.c +++ b/netlink.c @@ -1039,8 +1039,7 @@ static void netlink_phase_hook(void *sst, uint32_t new_phase) /* All the networks serviced by the various tunnels should now * have been registered. We build a routing table by sorting the * clients by priority. */ - st->routes=safe_malloc_ary(sizeof(*st->routes),st->n_clients, - "netlink_phase_hook"); + NEW_ARY(st->routes,st->n_clients); /* Fill the table */ i=0; for (c=st->clients; c; c=c->next) { diff --git a/site.c b/site.c index 94da06c..756ad35 100644 --- a/site.c +++ b/site.c @@ -1980,7 +1980,7 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context, if (!things##_cfg) \ cfgfatal(loc,"site","closure list \"%s\" not found\n",dictkey); \ st->nthings=list_length(things##_cfg); \ - st->things=safe_malloc_ary(sizeof(*st->things),st->nthings,dictkey "s"); \ + NEW_ARY(st->things,st->nthings); \ assert(st->nthings); \ for (i=0; inthings; i++) { \ item_t *item=list_elem(things##_cfg,i); \ -- 2.30.2