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.
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index 6730e94..e6f753c 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -47,12 +47,12 @@
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 @@
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 (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 (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 (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;
}