*: 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 <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: v2: fix XFREE(0, foo) calls too]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2016-07-28 17:23:49 +02:00 committed by Donald Sharp
parent 5ef104fc41
commit c66f9c6186
8 changed files with 13 additions and 13 deletions

View File

@ -572,7 +572,7 @@ str2prefix_ipv6 (const char *str, struct prefix_ipv6 *p)
{ {
int plen; int plen;
cp = XMALLOC (0, (pnt - str) + 1); cp = XMALLOC (MTYPE_TMP, (pnt - str) + 1);
strncpy (cp, str, pnt - str); strncpy (cp, str, pnt - str);
*(cp + (pnt - str)) = '\0'; *(cp + (pnt - str)) = '\0';
ret = inet_pton (AF_INET6, cp, &p->prefix); ret = inet_pton (AF_INET6, cp, &p->prefix);

View File

@ -23,7 +23,7 @@
#ifndef _OSPF_APICLIENT_H #ifndef _OSPF_APICLIENT_H
#define _OSPF_APICLIENT_H #define _OSPF_APICLIENT_H
#define MTYPE_OSPF_APICLIENT 0 #define MTYPE_OSPF_APICLIENT MTYPE_TMP
/* Structure for the OSPF API client */ /* Structure for the OSPF API client */
struct ospf_apiclient struct ospf_apiclient

View File

@ -22,9 +22,9 @@
*/ */
/***** MTYPE definitions are not reflected to "memory.h" yet. *****/ /***** MTYPE definitions are not reflected to "memory.h" yet. *****/
#define MTYPE_OSPF_OPAQUE_FUNCTAB 0 #define MTYPE_OSPF_OPAQUE_FUNCTAB MTYPE_TMP
#define MTYPE_OPAQUE_INFO_PER_TYPE 0 #define MTYPE_OPAQUE_INFO_PER_TYPE MTYPE_TMP
#define MTYPE_OPAQUE_INFO_PER_ID 0 #define MTYPE_OPAQUE_INFO_PER_ID MTYPE_TMP
#include <zebra.h> #include <zebra.h>
#ifdef HAVE_OPAQUE_LSA #ifdef HAVE_OPAQUE_LSA

View File

@ -1420,13 +1420,13 @@ struct ospf_snmp_if
static struct ospf_snmp_if * static struct ospf_snmp_if *
ospf_snmp_if_new (void) ospf_snmp_if_new (void)
{ {
return XCALLOC (0, sizeof (struct ospf_snmp_if)); return XCALLOC (MTYPE_TMP, sizeof (struct ospf_snmp_if));
} }
static void static void
ospf_snmp_if_free (struct ospf_snmp_if *osif) ospf_snmp_if_free (struct ospf_snmp_if *osif)
{ {
XFREE (0, osif); XFREE (MTYPE_TMP, osif);
} }
void void

View File

@ -22,7 +22,7 @@
*/ */
/***** MTYPE definition is not reflected to "memory.h" yet. *****/ /***** 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 <zebra.h> #include <zebra.h>

View File

@ -317,7 +317,7 @@ main (int argc, char **argv, char **env)
case 'c': case 'c':
{ {
struct cmd_rec *cr; struct cmd_rec *cr;
cr = XMALLOC(0, sizeof(*cr)); cr = XMALLOC(MTYPE_TMP, sizeof(*cr));
cr->line = optarg; cr->line = optarg;
cr->next = NULL; cr->next = NULL;
if (tail) if (tail)
@ -501,7 +501,7 @@ main (int argc, char **argv, char **env)
struct cmd_rec *cr; struct cmd_rec *cr;
cr = cmd; cr = cmd;
cmd = cmd->next; cmd = cmd->next;
XFREE(0, cr); XFREE(MTYPE_TMP, cr);
} }
} }

View File

@ -116,7 +116,7 @@ struct list *userlist;
static struct vtysh_user * static struct vtysh_user *
user_new (void) user_new (void)
{ {
return XCALLOC (0, sizeof (struct vtysh_user)); return XCALLOC (MTYPE_TMP, sizeof (struct vtysh_user));
} }
static struct vtysh_user * static struct vtysh_user *

View File

@ -1867,7 +1867,7 @@ zebra_client_close (struct zserv *client)
/* Free client structure. */ /* Free client structure. */
listnode_delete (zebrad.client_list, client); listnode_delete (zebrad.client_list, client);
XFREE (0, client); XFREE (MTYPE_TMP, client);
} }
/* Make new client. */ /* Make new client. */
@ -1878,7 +1878,7 @@ zebra_client_create (int sock)
int i; int i;
afi_t afi; afi_t afi;
client = XCALLOC (0, sizeof (struct zserv)); client = XCALLOC (MTYPE_TMP, sizeof (struct zserv));
/* Make client input/output buffer. */ /* Make client input/output buffer. */
client->sock = sock; client->sock = sock;