Acked-by: Donald Sharp <[email protected]>

On Wed, Feb 24, 2016 at 12:26 AM, David Lamparter <
[email protected]> wrote:

> 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 <[email protected]>
> ---
>  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    | 65
> -------------------------------------------------------
>  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(+), 70 deletions(-)
>
> diff --git a/lib/buffer.c b/lib/buffer.c
> index ee93101..1dfcdb4 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 8089360..0cd2245 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 6a20e23..16f1784 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 ba8043c..da6f68e 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 a472941..7476d32 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 56e41fa..570329a 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 920c668..b640b71 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 44b8586..b6c8b61 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 b3d14ba..3832021 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 e4a83de..ad746f1 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 8a2fdd2..a526614 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 4b16f07..02e91f1 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 41de03a..b898d77 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 592b683..80914b8 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 56af4a4..8e9608a 100644
> --- a/lib/memory.h
> +++ b/lib/memory.h
> @@ -136,6 +136,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));
> @@ -198,6 +201,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 ae6532a..fe78f50 100644
> --- a/lib/memtypes.c
> +++ b/lib/memtypes.c
> @@ -10,71 +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 699c9b1..eaafcf3 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 69ab8e6..0f87056 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 aeb627b..8225784 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 0ca8783..766f82c 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 7302e23..f3d5ef0 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 2479c81..e8e1264 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 4a22c63..14fea63 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 ca1a40f..7fd25b3 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 da21361..8858aea 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 2ffd79b..34c196a 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 5e40261..c3713e1 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 7c14862..03ad317 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 6b27fd9..d8f4c78 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 29be02a..fc56739 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 aafa271..7935316 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 b1a5d5b..29a6bdc 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 5ad2589..00952f8 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 7d800d4..464219c 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 82bf262..0658e0d 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.3.6
>
>
> _______________________________________________
> Quagga-dev mailing list
> [email protected]
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to