summaryrefslogtreecommitdiff
path: root/lib/if_rmap.c
diff options
context:
space:
mode:
authorpaul <paul>2005-10-26 05:05:16 +0000
committerpaul <paul>2005-10-26 05:05:16 +0000
commit0241684ea77e8aa20ad2cb3903589559f4a7b009 (patch)
tree2bb64a53f5d8c1091839be9e1afb6e4625828f38 /lib/if_rmap.c
parent216565ab68148d3161422c0d73730614bfeccd7c (diff)
2005-10-26 Paul Jakma <paul.jakma@sun.com>
* (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.
Diffstat (limited to 'lib/if_rmap.c')
-rw-r--r--lib/if_rmap.c22
1 files changed, 12 insertions, 10 deletions
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;
}