From 0241684ea77e8aa20ad2cb3903589559f4a7b009 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 26 Oct 2005 05:05:16 +0000 Subject: 2005-10-26 Paul Jakma * (general) Cleanup a some calls to XFREE,strdup, etc. to use the memory.h macros. * memtypes.c: Add MTYPE_IF_RMAP_NAME, MTYPE_PQUEUE, MTYPE_PQUEUE_DATA and MTYPE_HOST. * memtypes.h: update auto-built file. * if_rmap.c: Use MTYPE_IF_RMAP_NAME. * pqueue.c: Use the two MTYPE_PQUEUE mtypes for allocations. --- lib/if_rmap.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/if_rmap.c') diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 6730e94c..e6f753c2 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -47,12 +47,12 @@ static void if_rmap_free (struct if_rmap *if_rmap) { if (if_rmap->ifname) - free (if_rmap->ifname); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->ifname); if (if_rmap->routemap[IF_RMAP_IN]) - free (if_rmap->routemap[IF_RMAP_IN]); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]); if (if_rmap->routemap[IF_RMAP_OUT]) - free (if_rmap->routemap[IF_RMAP_OUT]); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]); XFREE (MTYPE_IF_RMAP, if_rmap); } @@ -90,7 +90,7 @@ if_rmap_hash_alloc (void *arg) struct if_rmap *if_rmap; if_rmap = if_rmap_new (); - if_rmap->ifname = strdup (ifarg->ifname); + if_rmap->ifname = XSTRDUP (MTYPE_IF_RMAP_NAME, ifarg->ifname); return if_rmap; } @@ -140,14 +140,16 @@ if_rmap_set (const char *ifname, enum if_rmap_type type, if (type == IF_RMAP_IN) { if (if_rmap->routemap[IF_RMAP_IN]) - free (if_rmap->routemap[IF_RMAP_IN]); - if_rmap->routemap[IF_RMAP_IN] = strdup (routemap_name); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]); + if_rmap->routemap[IF_RMAP_IN] + = XSTRDUP (MTYPE_IF_RMAP_NAME, routemap_name); } if (type == IF_RMAP_OUT) { if (if_rmap->routemap[IF_RMAP_OUT]) - free (if_rmap->routemap[IF_RMAP_OUT]); - if_rmap->routemap[IF_RMAP_OUT] = strdup (routemap_name); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]); + if_rmap->routemap[IF_RMAP_OUT] + = XSTRDUP (MTYPE_IF_RMAP_NAME, routemap_name); } if (if_rmap_add_hook) @@ -173,7 +175,7 @@ if_rmap_unset (const char *ifname, enum if_rmap_type type, if (strcmp (if_rmap->routemap[IF_RMAP_IN], routemap_name) != 0) return 0; - free (if_rmap->routemap[IF_RMAP_IN]); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]); if_rmap->routemap[IF_RMAP_IN] = NULL; } @@ -184,7 +186,7 @@ if_rmap_unset (const char *ifname, enum if_rmap_type type, if (strcmp (if_rmap->routemap[IF_RMAP_OUT], routemap_name) != 0) return 0; - free (if_rmap->routemap[IF_RMAP_OUT]); + XFREE (MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]); if_rmap->routemap[IF_RMAP_OUT] = NULL; } -- cgit v1.2.1