lib: use MTYPE_STATIC

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2019-06-21 08:25:42 +02:00
parent 8b7454e9c2
commit eaf58ba906
14 changed files with 13 additions and 31 deletions

View File

@ -7722,14 +7722,6 @@ DEFUN (show_bgp_memory,
count * sizeof(struct peer_group)));
/* Other */
if ((count = mtype_stats_alloc(MTYPE_HASH)))
vty_out(vty, "%ld hash tables, using %s of memory\n", count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct hash)));
if ((count = mtype_stats_alloc(MTYPE_HASH_BACKET)))
vty_out(vty, "%ld hash buckets, using %s of memory\n", count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct hash_bucket)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf),

View File

@ -48,7 +48,7 @@
#include "lib_errors.h"
#include "northbound_cli.h"
DEFINE_MTYPE(LIB, HOST, "Host config")
DEFINE_MTYPE_STATIC(LIB, HOST, "Host config")
DEFINE_MTYPE(LIB, COMPLETION, "Completion item")
#define item(x) \

View File

@ -34,7 +34,6 @@
extern "C" {
#endif
DECLARE_MTYPE(HOST)
DECLARE_MTYPE(COMPLETION)
/*

View File

@ -28,8 +28,8 @@
#include "memory.h"
#include "linklist.h"
DEFINE_MTYPE(LIB, FRR_PTHREAD, "FRR POSIX Thread");
DEFINE_MTYPE(LIB, PTHREAD_PRIM, "POSIX synchronization primitives");
DEFINE_MTYPE_STATIC(LIB, FRR_PTHREAD, "FRR POSIX Thread")
DEFINE_MTYPE_STATIC(LIB, PTHREAD_PRIM, "POSIX sync primitives")
/* default frr_pthread start/stop routine prototypes */
static void *fpt_run(void *arg);

View File

@ -29,9 +29,6 @@
extern "C" {
#endif
DECLARE_MTYPE(FRR_PTHREAD);
DECLARE_MTYPE(PTHREAD_PRIM);
#define OS_THREAD_NAMELEN 16
struct frr_pthread;

View File

@ -29,8 +29,8 @@
#include "command.h"
#include "libfrr.h"
DEFINE_MTYPE(LIB, HASH, "Hash")
DEFINE_MTYPE(LIB, HASH_BACKET, "Hash Bucket")
DEFINE_MTYPE_STATIC(LIB, HASH, "Hash")
DEFINE_MTYPE_STATIC(LIB, HASH_BACKET, "Hash Bucket")
DEFINE_MTYPE_STATIC(LIB, HASH_INDEX, "Hash Index")
static pthread_mutex_t _hashes_mtx = PTHREAD_MUTEX_INITIALIZER;

View File

@ -28,9 +28,6 @@
extern "C" {
#endif
DECLARE_MTYPE(HASH)
DECLARE_MTYPE(HASH_BACKET)
/* Default hash table size. */
#define HASH_INITIAL_SIZE 256
/* Expansion threshold */

View File

@ -39,7 +39,7 @@
#include "lib/if_clippy.c"
#endif
DEFINE_MTYPE(LIB, IF, "Interface")
DEFINE_MTYPE_STATIC(LIB, IF, "Interface")
DEFINE_MTYPE_STATIC(LIB, CONNECTED, "Connected")
DEFINE_MTYPE_STATIC(LIB, NBR_CONNECTED, "Neighbor Connected")
DEFINE_MTYPE(LIB, CONNECTED_LABEL, "Connected interface label")

View File

@ -31,7 +31,6 @@
extern "C" {
#endif
DECLARE_MTYPE(IF)
DECLARE_MTYPE(CONNECTED_LABEL)
/* Interface link-layer type, if known. Derived from:

View File

@ -28,7 +28,7 @@
#include "memory.h"
#include "sockunion.h"
DEFINE_MTYPE(LIB, ROUTE_TABLE, "Route table")
DEFINE_MTYPE_STATIC(LIB, ROUTE_TABLE, "Route table")
DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node")
static void route_table_free(struct route_table *);

View File

@ -31,7 +31,6 @@
extern "C" {
#endif
DECLARE_MTYPE(ROUTE_TABLE)
DECLARE_MTYPE(ROUTE_NODE)
/*

View File

@ -27,8 +27,8 @@
#include <libyang/user_types.h>
DEFINE_MTYPE(LIB, YANG_MODULE, "YANG module")
DEFINE_MTYPE(LIB, YANG_DATA, "YANG data structure")
DEFINE_MTYPE_STATIC(LIB, YANG_MODULE, "YANG module")
DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure")
/* libyang container. */
struct ly_ctx *ly_native_ctx;

View File

@ -33,9 +33,6 @@
extern "C" {
#endif
DECLARE_MTYPE(YANG_MODULE)
DECLARE_MTYPE(YANG_DATA)
/* Maximum XPath length. */
#define XPATH_MAXLEN 256

View File

@ -49,6 +49,8 @@
#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
#endif
DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_IF, "ripng interface")
/* Static utility function. */
static void ripng_enable_apply(struct interface *);
static void ripng_passive_interface_apply(struct interface *);
@ -913,7 +915,7 @@ static struct ripng_interface *ri_new(void)
{
struct ripng_interface *ri;
ri = XCALLOC(MTYPE_IF, sizeof(struct ripng_interface));
ri = XCALLOC(MTYPE_RIPNG_IF, sizeof(struct ripng_interface));
/* Set default split-horizon behavior. If the interface is Frame
Relay or SMDS is enabled, the default value for split-horizon is
@ -950,7 +952,7 @@ static int ripng_if_new_hook(struct interface *ifp)
/* Called when interface structure deleted. */
static int ripng_if_delete_hook(struct interface *ifp)
{
XFREE(MTYPE_IF, ifp->info);
XFREE(MTYPE_RIPNG_IF, ifp->info);
ifp->info = NULL;
return 0;
}