From: David Lamparter <equi...@opensourcerouting.org>

This places MTYPE definitions into the files where they're actually
used, making most of them static in the process.

Signed-off-by: David Lamparter <equi...@opensourcerouting.org>
Reviewed-by: Philippe Guibert <philippe.guib...@6wind.com>
---
 lib/buffer.c      |  3 ++-
 lib/command.c     |  4 ++++
 lib/command.h     |  6 ++++++
 lib/distribute.c  |  3 +++
 lib/filter.c      |  4 ++++
 lib/hash.c        |  4 ++++
 lib/hash.h        |  5 +++++
 lib/if.c          |  4 ++++
 lib/if.h          |  4 ++++
 lib/if_rmap.c     |  3 +++
 lib/keychain.c    |  3 +++
 lib/linklist.c    |  3 +++
 lib/log.c         |  2 ++
 lib/memory.c      |  3 +++
 lib/memory.h      |  5 +++--
 lib/memtypes.c    | 64 -------------------------------------------------------
 lib/plist.c       |  8 +++++--
 lib/pqueue.c      |  3 +++
 lib/prefix.c      |  2 ++
 lib/privs.c       |  3 +++
 lib/routemap.c    |  7 ++++++
 lib/routemap.h    |  4 ++++
 lib/sockunion.c   |  2 ++
 lib/stream.c      |  4 ++++
 lib/table.c       |  3 +++
 lib/table.h       |  3 +++
 lib/thread.c      |  4 ++++
 lib/vector.c      |  3 +++
 lib/vector.h      |  3 +++
 lib/vrf.c         |  4 ++++
 lib/vty.c         |  4 ++++
 lib/workqueue.c   |  4 ++++
 lib/workqueue.h   |  3 +++
 lib/zclient.c     |  2 ++
 zebra/zebra_vty.c |  1 +
 35 files changed, 118 insertions(+), 69 deletions(-)

diff --git a/lib/buffer.c b/lib/buffer.c
index ee9310100e48..1dfcdb4732dc 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -28,7 +28,8 @@
 #include "network.h"
 #include <stddef.h>
 
-
+DEFINE_MTYPE_STATIC(LIB, BUFFER,      "Buffer")
+DEFINE_MTYPE_STATIC(LIB, BUFFER_DATA, "Buffer data")
 
 /* Buffer master. */
 struct buffer
diff --git a/lib/command.c b/lib/command.c
index 80893602da17..0cd2245d0250 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -33,6 +33,10 @@ Boston, MA 02111-1307, USA.  */
 #include "command.h"
 #include "workqueue.h"
 
+DEFINE_MTYPE(       LIB, HOST,       "Host config")
+DEFINE_MTYPE(       LIB, STRVEC,     "String vector")
+DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
+
 /* Command vector which includes some level of command lists. Normally
    each daemon maintains each own cmdvec. */
 vector cmdvec = NULL;
diff --git a/lib/command.h b/lib/command.h
index 6a20e2324efc..16f1784c1266 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -26,6 +26,12 @@
 #include "vector.h"
 #include "vty.h"
 #include "lib/route_types.h"
+#include "memory.h"
+
+DECLARE_MTYPE(HOST)
+
+/* for test-commands.c */
+DECLARE_MTYPE(STRVEC)
 
 /* Host configuration variable */
 struct host
diff --git a/lib/distribute.c b/lib/distribute.c
index ba8043cf9e08..da6f68e3e105 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -28,6 +28,9 @@
 #include "distribute.h"
 #include "memory.h"
 
+DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE,        "Distribute list")
+DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_IFNAME, "Dist-list ifname")
+
 /* Hash of distribute list. */
 struct hash *disthash;
 
diff --git a/lib/filter.c b/lib/filter.c
index a472941406f7..7476d32d7354 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -29,6 +29,10 @@
 #include "buffer.h"
 #include "log.h"
 
+DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST,     "Access List")
+DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST_STR, "Access List Str")
+DEFINE_MTYPE_STATIC(LIB, ACCESS_FILTER,   "Access Filter")
+
 struct filter_cisco
 {
   /* Cisco access-list */
diff --git a/lib/hash.c b/lib/hash.c
index 56e41fa82605..570329a1f477 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -24,6 +24,10 @@
 #include "hash.h"
 #include "memory.h"
 
+DEFINE_MTYPE(       LIB, HASH,        "Hash")
+DEFINE_MTYPE(       LIB, HASH_BACKET, "Hash Bucket")
+DEFINE_MTYPE_STATIC(LIB, HASH_INDEX,  "Hash Index")
+
 /* Allocate a new hash.  */
 struct hash *
 hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),
diff --git a/lib/hash.h b/lib/hash.h
index 920c6685fb69..b640b71182d5 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -21,6 +21,11 @@ Boston, MA 02111-1307, USA.  */
 #ifndef _ZEBRA_HASH_H
 #define _ZEBRA_HASH_H
 
+#include "memory.h"
+
+DECLARE_MTYPE(HASH)
+DECLARE_MTYPE(HASH_BACKET)
+
 /* Default hash table size.  */ 
 #define HASH_INITIAL_SIZE     256      /* initial number of backets. */
 #define HASH_THRESHOLD       10        /* expand when backet. */
diff --git a/lib/if.c b/lib/if.c
index 44b8586e47e5..b6c8b61260df 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -37,6 +37,10 @@
 #include "str.h"
 #include "log.h"
 
+DEFINE_MTYPE(       LIB, IF,              "Interface")
+DEFINE_MTYPE_STATIC(LIB, CONNECTED,       "Connected")
+DEFINE_MTYPE(       LIB, CONNECTED_LABEL, "Connected interface label")
+
 /* List of interfaces in only the default VRF */
 struct list *iflist;
 
diff --git a/lib/if.h b/lib/if.h
index b3d14ba4e0e5..383202187060 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -23,6 +23,10 @@ Boston, MA 02111-1307, USA.  */
 
 #include "zebra.h"
 #include "linklist.h"
+#include "memory.h"
+
+DECLARE_MTYPE(IF)
+DECLARE_MTYPE(CONNECTED_LABEL)
 
 /* Interface link-layer type, if known. Derived from:
  *
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index e4a83de8bb85..ad746f1c37f1 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -27,6 +27,9 @@
 #include "if.h"
 #include "if_rmap.h"
 
+DEFINE_MTYPE_STATIC(LIB, IF_RMAP,      "Interface route map")
+DEFINE_MTYPE_STATIC(LIB, IF_RMAP_NAME, "I.f. route map name")
+
 struct hash *ifrmaphash;
 
 /* Hook functions. */
diff --git a/lib/keychain.c b/lib/keychain.c
index 8a2fdd2ed9fb..a526614ae0d2 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA.  */
 #include "linklist.h"
 #include "keychain.h"
 
+DEFINE_MTYPE_STATIC(LIB, KEY,      "Key")
+DEFINE_MTYPE_STATIC(LIB, KEYCHAIN, "Key chain")
+
 /* Master list of key chain. */
 struct list *keychain_list;
 
diff --git a/lib/linklist.c b/lib/linklist.c
index 4b16f07dd1c3..02e91f19bfbb 100644
--- a/lib/linklist.c
+++ b/lib/linklist.c
@@ -24,6 +24,9 @@
 #include "linklist.h"
 #include "memory.h"
 
+DEFINE_MTYPE_STATIC(LIB, LINK_LIST, "Link List")
+DEFINE_MTYPE_STATIC(LIB, LINK_NODE, "Link Node")
+
 /* Allocate new list. */
 struct list *
 list_new (void)
diff --git a/lib/log.c b/lib/log.c
index 6b9cef76cf5a..51b049cad9cb 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -35,6 +35,8 @@
 #include <ucontext.h>
 #endif
 
+DEFINE_MTYPE_STATIC(LIB, ZLOG, "Logging")
+
 static int logfile_fd = -1;    /* Used in signal handler. */
 
 struct zlog *zlog_default = NULL;
diff --git a/lib/memory.c b/lib/memory.c
index 43ef51cba7ca..eafff77b0352 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -29,6 +29,9 @@
 static struct memgroup *mg_first = NULL;
 struct memgroup **mg_insert = &mg_first;
 
+DEFINE_MGROUP(LIB, "libzebra")
+DEFINE_MTYPE(LIB, TMP, "Temporary memory")
+
 static inline void mt_count_alloc(struct memtype *mt, size_t size)
 {
        mt->n_alloc++;
diff --git a/lib/memory.h b/lib/memory.h
index c052b9936b48..8fbb6c310b8e 100644
--- a/lib/memory.h
+++ b/lib/memory.h
@@ -131,6 +131,9 @@ struct memgroup {
        DEFINE_MTYPE_ATTR(group, name, static, desc) \
        static struct memtype * const MTYPE_ ## name = &_mt_##name;
 
+DECLARE_MGROUP(LIB)
+DECLARE_MTYPE(TMP)
+
 
 extern void *qmalloc (struct memtype *mt, size_t size)
        __attribute__ ((malloc, _ALLOC_SIZE(2), nonnull (1) _RET_NONNULL));
@@ -192,6 +195,4 @@ extern int qmem_walk (qmem_walk_fn *func, void *arg);
 
 extern void memory_oom (size_t size, const char *name);
 
-#include "memtypes.h"
-
 #endif /* _QUAGGA_MEMORY_H */
diff --git a/lib/memtypes.c b/lib/memtypes.c
index 38d2811745d3..fe78f50ba062 100644
--- a/lib/memtypes.c
+++ b/lib/memtypes.c
@@ -10,70 +10,6 @@
 #include "zebra.h"
 #include "memory.h"
 
-DEFINE_MGROUP(LIB, "libzebra")
-DEFINE_MTYPE(LIB, TMP,                 "Temporary memory")
-DEFINE_MTYPE(LIB, STRVEC,                      "String vector")
-DEFINE_MTYPE(LIB, VECTOR,                      "Vector")
-DEFINE_MTYPE(LIB, VECTOR_INDEX,                "Vector index")
-DEFINE_MTYPE(LIB, LINK_LIST,           "Link List")
-DEFINE_MTYPE(LIB, LINK_NODE,           "Link Node")
-DEFINE_MTYPE(LIB, THREAD,                      "Thread")
-DEFINE_MTYPE(LIB, THREAD_MASTER,               "Thread master")
-DEFINE_MTYPE(LIB, THREAD_STATS,                "Thread stats")
-DEFINE_MTYPE(LIB, VTY,                 "VTY")
-DEFINE_MTYPE(LIB, VTY_OUT_BUF,         "VTY output buffer")
-DEFINE_MTYPE(LIB, VTY_HIST,            "VTY history")
-DEFINE_MTYPE(LIB, IF,                  "Interface")
-DEFINE_MTYPE(LIB, CONNECTED,           "Connected")
-DEFINE_MTYPE(LIB, CONNECTED_LABEL,             "Connected interface label")
-DEFINE_MTYPE(LIB, BUFFER,                      "Buffer")
-DEFINE_MTYPE(LIB, BUFFER_DATA,         "Buffer data")
-DEFINE_MTYPE(LIB, STREAM,                      "Stream")
-DEFINE_MTYPE(LIB, STREAM_DATA,         "Stream data")
-DEFINE_MTYPE(LIB, STREAM_FIFO,         "Stream FIFO")
-DEFINE_MTYPE(LIB, PREFIX,                      "Prefix")
-DEFINE_MTYPE(LIB, PREFIX_IPV4,         "Prefix IPv4")
-DEFINE_MTYPE(LIB, PREFIX_IPV6,         "Prefix IPv6")
-DEFINE_MTYPE(LIB, HASH,                        "Hash")
-DEFINE_MTYPE(LIB, HASH_BACKET,         "Hash Bucket")
-DEFINE_MTYPE(LIB, HASH_INDEX,          "Hash Index")
-DEFINE_MTYPE(LIB, ROUTE_TABLE,         "Route table")
-DEFINE_MTYPE(LIB, ROUTE_NODE,          "Route node")
-DEFINE_MTYPE(LIB, DISTRIBUTE,          "Distribute list")
-DEFINE_MTYPE(LIB, DISTRIBUTE_IFNAME,   "Dist-list ifname")
-DEFINE_MTYPE(LIB, ACCESS_LIST,         "Access List")
-DEFINE_MTYPE(LIB, ACCESS_LIST_STR,             "Access List Str")
-DEFINE_MTYPE(LIB, ACCESS_FILTER,               "Access Filter")
-DEFINE_MTYPE(LIB, PREFIX_LIST,         "Prefix List")
-DEFINE_MTYPE(LIB, PREFIX_LIST_ENTRY,   "Prefix List Entry")
-DEFINE_MTYPE(LIB, PREFIX_LIST_STR,             "Prefix List Str")
-DEFINE_MTYPE(LIB, ROUTE_MAP,           "Route map")
-DEFINE_MTYPE(LIB, ROUTE_MAP_NAME,              "Route map name")
-DEFINE_MTYPE(LIB, ROUTE_MAP_INDEX,             "Route map index")
-DEFINE_MTYPE(LIB, ROUTE_MAP_RULE,              "Route map rule")
-DEFINE_MTYPE(LIB, ROUTE_MAP_RULE_STR,  "Route map rule str")
-DEFINE_MTYPE(LIB, ROUTE_MAP_COMPILED,  "Route map compiled")
-DEFINE_MTYPE(LIB, CMD_TOKENS,          "Command desc")
-DEFINE_MTYPE(LIB, KEY,                 "Key")
-DEFINE_MTYPE(LIB, KEYCHAIN,            "Key chain")
-DEFINE_MTYPE(LIB, IF_RMAP,                     "Interface route map")
-DEFINE_MTYPE(LIB, IF_RMAP_NAME,                "I.f. route map name")
-DEFINE_MTYPE(LIB, SOCKUNION,           "Socket union")
-DEFINE_MTYPE(LIB, PRIVS,                       "Privilege information")
-DEFINE_MTYPE(LIB, ZLOG,                        "Logging")
-DEFINE_MTYPE(LIB, ZCLIENT,                     "Zclient")
-DEFINE_MTYPE(LIB, WORK_QUEUE,          "Work queue")
-DEFINE_MTYPE(LIB, WORK_QUEUE_ITEM,             "Work queue item")
-DEFINE_MTYPE(LIB, WORK_QUEUE_NAME,             "Work queue name string")
-DEFINE_MTYPE(LIB, PQUEUE,                      "Priority queue")
-DEFINE_MTYPE(LIB, PQUEUE_DATA,         "Priority queue data")
-DEFINE_MTYPE(LIB, HOST, "host configuration")
-DEFINE_MTYPE(LIB, VRF,                 "VRF")
-DEFINE_MTYPE(LIB, VRF_NAME,            "VRF name")
-DEFINE_MTYPE(LIB, VRF_BITMAP,          "VRF bit-map")
-
-
-
 DEFINE_MGROUP(BABELD, "babeld")
 DEFINE_MTYPE(BABELD, BABEL,            "Babel structure")
 DEFINE_MTYPE(BABELD, BABEL_IF,         "Babel interface")
diff --git a/lib/plist.c b/lib/plist.c
index 699c9b131d6c..eaafcf3f98d8 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -32,6 +32,10 @@
 
 #include "plist_int.h"
 
+DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST,       "Prefix List")
+DEFINE_MTYPE_STATIC(LIB, MPREFIX_LIST_STR,   "Prefix List Str")
+DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_ENTRY, "Prefix List Entry")
+
 /* List of struct prefix_list. */
 struct prefix_list_list
 {
@@ -203,7 +207,7 @@ prefix_list_insert (afi_t afi, int orf, const char *name)
 
   /* Allocate new prefix_list and copy given name. */
   plist = prefix_list_new ();
-  plist->name = XSTRDUP (MTYPE_PREFIX_LIST_STR, name);
+  plist->name = XSTRDUP (MTYPE_MPREFIX_LIST_STR, name);
   plist->master = master;
 
   /* If name is made by all digit character.  We treat it as
@@ -331,7 +335,7 @@ prefix_list_delete (struct prefix_list *plist)
   master->recent = NULL;
 
   if (plist->name)
-    XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
+    XFREE (MTYPE_MPREFIX_LIST_STR, plist->name);
   
   prefix_list_free (plist);
   
diff --git a/lib/pqueue.c b/lib/pqueue.c
index 69ab8e65d6c2..0f870564dab7 100644
--- a/lib/pqueue.c
+++ b/lib/pqueue.c
@@ -23,6 +23,9 @@ Boston, MA 02111-1307, USA.  */
 #include "memory.h"
 #include "pqueue.h"
 
+DEFINE_MTYPE_STATIC(LIB, PQUEUE,      "Priority queue")
+DEFINE_MTYPE_STATIC(LIB, PQUEUE_DATA, "Priority queue data")
+
 /* priority queue using heap sort */
 
 /* pqueue->cmp() controls the order of sorting (i.e, ascending or
diff --git a/lib/prefix.c b/lib/prefix.c
index 3d82b91a6f96..6a422d2e91c8 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -28,6 +28,8 @@
 #include "memory.h"
 #include "log.h"
 
+DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix")
+
 /* Maskbit. */
 static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
                                 0xf8, 0xfc, 0xfe, 0xff};
diff --git a/lib/privs.c b/lib/privs.c
index e6d76b600b0d..6ddc036da34d 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -27,6 +27,9 @@
 #include "memory.h"
 
 #ifdef HAVE_CAPABILITIES
+
+DEFINE_MTYPE_STATIC(LIB, PRIVS, "Privilege information")
+
 /* sort out some generic internal types for:
  *
  * privilege values (cap_value_t, priv_t)      -> pvalue_t
diff --git a/lib/routemap.c b/lib/routemap.c
index 116c8bd81ff0..91303eea9c4c 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -29,6 +29,13 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, 
Boston, MA
 #include "vty.h"
 #include "log.h"
 
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP,          "Route map")
+DEFINE_MTYPE(       LIB, ROUTE_MAP_NAME,     "Route map name")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX,    "Route map index")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_RULE,     "Route map rule")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_RULE_STR, "Route map rule str")
+DEFINE_MTYPE(       LIB, ROUTE_MAP_COMPILED, "Route map compiled")
+
 /* Vector for route match rules. */
 static vector route_match_vec;
 
diff --git a/lib/routemap.h b/lib/routemap.h
index 2479c81abfb6..e8e126419980 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -22,6 +22,10 @@
 #ifndef _ZEBRA_ROUTEMAP_H
 #define _ZEBRA_ROUTEMAP_H
 
+#include "memory.h"
+DECLARE_MTYPE(ROUTE_MAP_NAME)
+DECLARE_MTYPE(ROUTE_MAP_COMPILED)
+
 /* Route map's type. */
 enum route_map_type
 {
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 4a22c6386c79..14fea6331fc5 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -29,6 +29,8 @@
 #include "log.h"
 #include "jhash.h"
 
+DEFINE_MTYPE_STATIC(LIB, SOCKUNION, "Socket union")
+
 #ifndef HAVE_INET_ATON
 int
 inet_aton (const char *cp, struct in_addr *inaddr)
diff --git a/lib/stream.c b/lib/stream.c
index ca1a40f16898..7fd25b3c8e89 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -29,6 +29,10 @@
 #include "prefix.h"
 #include "log.h"
 
+DEFINE_MTYPE_STATIC(LIB, STREAM,      "Stream")
+DEFINE_MTYPE_STATIC(LIB, STREAM_DATA, "Stream data")
+DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
+
 /* Tests whether a position is valid */ 
 #define GETP_VALID(S,G) \
   ((G) <= (S)->endp)
diff --git a/lib/table.c b/lib/table.c
index da213616849b..8858aea0fd0d 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -27,6 +27,9 @@
 #include "memory.h"
 #include "sockunion.h"
 
+DEFINE_MTYPE(       LIB, ROUTE_TABLE, "Route table")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_NODE,  "Route node")
+
 static void route_node_delete (struct route_node *);
 static void route_table_free (struct route_table *);
 
diff --git a/lib/table.h b/lib/table.h
index 2ffd79b53f48..34c196aa47d2 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -23,6 +23,9 @@
 #ifndef _ZEBRA_TABLE_H
 #define _ZEBRA_TABLE_H
 
+#include "memory.h"
+DECLARE_MTYPE(ROUTE_TABLE)
+
 /*
  * Forward declarations.
  */
diff --git a/lib/thread.c b/lib/thread.c
index 5e40261e6a7e..c3713e193be0 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -31,6 +31,10 @@
 #include "command.h"
 #include "sigevent.h"
 
+DEFINE_MTYPE_STATIC(LIB, THREAD,        "Thread")
+DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master")
+DEFINE_MTYPE_STATIC(LIB, THREAD_STATS,  "Thread stats")
+
 #if defined HAVE_SNMP && defined SNMP_AGENTX
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
diff --git a/lib/vector.c b/lib/vector.c
index 7c1486285f38..03ad3171d660 100644
--- a/lib/vector.c
+++ b/lib/vector.c
@@ -24,6 +24,9 @@
 #include "vector.h"
 #include "memory.h"
 
+DEFINE_MTYPE_STATIC(LIB, VECTOR,       "Vector")
+DEFINE_MTYPE(       LIB, VECTOR_INDEX, "Vector index")
+
 /* Initialize vector : allocate memory and return vector. */
 vector
 vector_init (unsigned int size)
diff --git a/lib/vector.h b/lib/vector.h
index 6b27fd96d4f3..d8f4c78608cc 100644
--- a/lib/vector.h
+++ b/lib/vector.h
@@ -23,6 +23,9 @@
 #ifndef _ZEBRA_VECTOR_H
 #define _ZEBRA_VECTOR_H
 
+#include "memory.h"
+DECLARE_MTYPE(VECTOR_INDEX)
+
 /* struct for vector */
 struct _vector 
 {
diff --git a/lib/vrf.c b/lib/vrf.c
index 29be02a05387..fc567391712a 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -68,6 +68,10 @@ static int have_netns_enabled = -1;
 
 #endif /* HAVE_NETNS */
 
+DEFINE_MTYPE_STATIC(LIB, VRF,        "VRF")
+DEFINE_MTYPE_STATIC(LIB, VRF_NAME,   "VRF name")
+DEFINE_MTYPE_STATIC(LIB, VRF_BITMAP, "VRF bit-map")
+
 static int have_netns(void)
 {
 #ifdef HAVE_NETNS
diff --git a/lib/vty.c b/lib/vty.c
index 60f56355b1f2..5b8a9c64cad0 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -40,6 +40,10 @@
 #include <arpa/telnet.h>
 #include <termios.h>
 
+DEFINE_MTYPE_STATIC(LIB, VTY,         "VTY")
+DEFINE_MTYPE_STATIC(LIB, VTY_OUT_BUF, "VTY output buffer")
+DEFINE_MTYPE_STATIC(LIB, VTY_HIST,    "VTY history")
+
 /* Vty events */
 enum event 
 {
diff --git a/lib/workqueue.c b/lib/workqueue.c
index b1a5d5bfe53e..29a6bdc0a51e 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -29,6 +29,10 @@
 #include "command.h"
 #include "log.h"
 
+DEFINE_MTYPE(LIB, WORK_QUEUE,             "Work queue")
+DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_ITEM, "Work queue item")
+DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_NAME, "Work queue name string")
+
 /* master list of work_queues */
 static struct list _work_queues;
 /* pointer primarily to avoid an otherwise harmless warning on
diff --git a/lib/workqueue.h b/lib/workqueue.h
index 5ad25893b279..00952f8d2ada 100644
--- a/lib/workqueue.h
+++ b/lib/workqueue.h
@@ -24,6 +24,9 @@
 #ifndef _QUAGGA_WORK_QUEUE_H
 #define _QUAGGA_WORK_QUEUE_H
 
+#include "memory.h"
+DECLARE_MTYPE(WORK_QUEUE)
+
 /* Hold time for the initial schedule of a queue run, in  millisec */
 #define WORK_QUEUE_DEFAULT_HOLD  50 
 
diff --git a/lib/zclient.c b/lib/zclient.c
index 9d50ebc043f5..40b50aa6e636 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -33,6 +33,8 @@
 #include "memory.h"
 #include "table.h"
 
+DEFINE_MTYPE_STATIC(LIB, ZCLIENT, "Zclient")
+
 /* Zebra client events. */
 enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};
 
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index be6cf70e5bcc..e62221719358 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -29,6 +29,7 @@
 #include "table.h"
 #include "rib.h"
 #include "vrf.h"
+#include "routemap.h"
 
 #include "zebra/zserv.h"
 
-- 
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to