From c66f9c6186acb837a4fab441469a26b406f08e37 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Thu, 28 Jul 2016 17:23:49 +0200 Subject: [PATCH] *: get rid of "MTYPE 0" A few places are using 0 in place of the MTYPE_* argument. The following rewrite of the alloc tracking won't deal with that, so let's use MTYPE_TMP instead. Acked-by: Vincent JARDIN Acked-by: Donald Sharp [DL: v2: fix XFREE(0, foo) calls too] Signed-off-by: David Lamparter --- lib/prefix.c | 2 +- ospfclient/ospf_apiclient.h | 2 +- ospfd/ospf_opaque.c | 6 +++--- ospfd/ospf_snmp.c | 4 ++-- ospfd/ospf_te.c | 2 +- vtysh/vtysh_main.c | 4 ++-- vtysh/vtysh_user.c | 2 +- zebra/zserv.c | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/prefix.c b/lib/prefix.c index 256cd3a49a..c311b94eef 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -572,7 +572,7 @@ str2prefix_ipv6 (const char *str, struct prefix_ipv6 *p) { int plen; - cp = XMALLOC (0, (pnt - str) + 1); + cp = XMALLOC (MTYPE_TMP, (pnt - str) + 1); strncpy (cp, str, pnt - str); *(cp + (pnt - str)) = '\0'; ret = inet_pton (AF_INET6, cp, &p->prefix); diff --git a/ospfclient/ospf_apiclient.h b/ospfclient/ospf_apiclient.h index 0e74787ae0..809861995e 100644 --- a/ospfclient/ospf_apiclient.h +++ b/ospfclient/ospf_apiclient.h @@ -23,7 +23,7 @@ #ifndef _OSPF_APICLIENT_H #define _OSPF_APICLIENT_H -#define MTYPE_OSPF_APICLIENT 0 +#define MTYPE_OSPF_APICLIENT MTYPE_TMP /* Structure for the OSPF API client */ struct ospf_apiclient diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 4c05c77252..ff505b6bd3 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -22,9 +22,9 @@ */ /***** MTYPE definitions are not reflected to "memory.h" yet. *****/ -#define MTYPE_OSPF_OPAQUE_FUNCTAB 0 -#define MTYPE_OPAQUE_INFO_PER_TYPE 0 -#define MTYPE_OPAQUE_INFO_PER_ID 0 +#define MTYPE_OSPF_OPAQUE_FUNCTAB MTYPE_TMP +#define MTYPE_OPAQUE_INFO_PER_TYPE MTYPE_TMP +#define MTYPE_OPAQUE_INFO_PER_ID MTYPE_TMP #include #ifdef HAVE_OPAQUE_LSA diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 0eaf44b4d2..bedcb559bf 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -1420,13 +1420,13 @@ struct ospf_snmp_if static struct ospf_snmp_if * ospf_snmp_if_new (void) { - return XCALLOC (0, sizeof (struct ospf_snmp_if)); + return XCALLOC (MTYPE_TMP, sizeof (struct ospf_snmp_if)); } static void ospf_snmp_if_free (struct ospf_snmp_if *osif) { - XFREE (0, osif); + XFREE (MTYPE_TMP, osif); } void diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index db06623ddf..155a773b33 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -22,7 +22,7 @@ */ /***** MTYPE definition is not reflected to "memory.h" yet. *****/ -#define MTYPE_OSPF_MPLS_TE_LINKPARAMS 0 +#define MTYPE_OSPF_MPLS_TE_LINKPARAMS MTYPE_TMP #include diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index cd21c94efd..5bb3c61e52 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -317,7 +317,7 @@ main (int argc, char **argv, char **env) case 'c': { struct cmd_rec *cr; - cr = XMALLOC(0, sizeof(*cr)); + cr = XMALLOC(MTYPE_TMP, sizeof(*cr)); cr->line = optarg; cr->next = NULL; if (tail) @@ -501,7 +501,7 @@ main (int argc, char **argv, char **env) struct cmd_rec *cr; cr = cmd; cmd = cmd->next; - XFREE(0, cr); + XFREE(MTYPE_TMP, cr); } } diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index 0d72c378a3..988c768dce 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -116,7 +116,7 @@ struct list *userlist; static struct vtysh_user * user_new (void) { - return XCALLOC (0, sizeof (struct vtysh_user)); + return XCALLOC (MTYPE_TMP, sizeof (struct vtysh_user)); } static struct vtysh_user * diff --git a/zebra/zserv.c b/zebra/zserv.c index b36f8fe425..d625c02ff4 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1867,7 +1867,7 @@ zebra_client_close (struct zserv *client) /* Free client structure. */ listnode_delete (zebrad.client_list, client); - XFREE (0, client); + XFREE (MTYPE_TMP, client); } /* Make new client. */ @@ -1878,7 +1878,7 @@ zebra_client_create (int sock) int i; afi_t afi; - client = XCALLOC (0, sizeof (struct zserv)); + client = XCALLOC (MTYPE_TMP, sizeof (struct zserv)); /* Make client input/output buffer. */ client->sock = sock; -- 2.39.5