summaryrefslogtreecommitdiffstats
path: root/lib/memory_vty.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-01-06 10:37:22 +0100
committerChristian Franke <nobody@nowhere.ws>2016-09-19 18:35:50 +0200
commitfc7948fafee457874a21aa955c56a617b563f85c (patch)
tree919884f8b46b3b7ddbd6137d89dc8990e0739316 /lib/memory_vty.h
parentlib: add new extensible memory-type handling (diff)
downloadfrr-fc7948fafee457874a21aa955c56a617b563f85c.tar.xz
frr-fc7948fafee457874a21aa955c56a617b563f85c.zip
lib: migrate to new memory-type handling
Move over to the new allocation counting added in the previous commit. (This commit is mostly mechanical.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Diffstat (limited to 'lib/memory_vty.h')
-rw-r--r--lib/memory_vty.h64
1 files changed, 1 insertions, 63 deletions
diff --git a/lib/memory_vty.h b/lib/memory_vty.h
index d691b9b2b..7aab01ee5 100644
--- a/lib/memory_vty.h
+++ b/lib/memory_vty.h
@@ -21,73 +21,11 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _ZEBRA_MEMORY_VTY_H
#define _ZEBRA_MEMORY_VTY_H
-/* For pretty printing of memory allocate information. */
-struct memory_list
-{
- int index;
- const char *format;
-};
+#include "memory.h"
-struct mlist {
- struct memory_list *list;
- const char *name;
-};
-
-#include "lib/memtypes.h"
-
-extern struct mlist mlists[];
-
-/* #define MEMORY_LOG */
-#ifdef MEMORY_LOG
-#define XMALLOC(mtype, size) \
- mtype_zmalloc (__FILE__, __LINE__, (mtype), (size))
-#define XCALLOC(mtype, size) \
- mtype_zcalloc (__FILE__, __LINE__, (mtype), (size))
-#define XREALLOC(mtype, ptr, size) \
- mtype_zrealloc (__FILE__, __LINE__, (mtype), (ptr), (size))
-#define XFREE(mtype, ptr) \
- do { \
- mtype_zfree (__FILE__, __LINE__, (mtype), (ptr)); \
- ptr = NULL; } \
- while (0)
-#define XSTRDUP(mtype, str) \
- mtype_zstrdup (__FILE__, __LINE__, (mtype), (str))
-#else
-#define XMALLOC(mtype, size) zmalloc ((mtype), (size))
-#define XCALLOC(mtype, size) zcalloc ((mtype), (size))
-#define XREALLOC(mtype, ptr, size) zrealloc ((mtype), (ptr), (size))
-#define XFREE(mtype, ptr) do { \
- zfree ((mtype), (ptr)); \
- ptr = NULL; } \
- while (0)
-#define XSTRDUP(mtype, str) zstrdup ((mtype), (str))
-#endif /* MEMORY_LOG */
-
-/* Prototypes of memory function. */
-extern void *zmalloc (int type, size_t size);
-extern void *zcalloc (int type, size_t size);
-extern void *zrealloc (int type, void *ptr, size_t size);
-extern void zfree (int type, void *ptr);
-extern char *zstrdup (int type, const char *str);
-
-extern void *mtype_zmalloc (const char *file, int line, int type, size_t size);
-
-extern void *mtype_zcalloc (const char *file, int line, int type, size_t size);
-
-extern void *mtype_zrealloc (const char *file, int line, int type, void *ptr,
- size_t size);
-
-extern void mtype_zfree (const char *file, int line, int type,
- void *ptr);
-
-extern char *mtype_zstrdup (const char *file, int line, int type,
- const char *str);
extern void memory_init (void);
extern void log_memstats_stderr (const char *);
-/* return number of allocations outstanding for the type */
-extern unsigned long mtype_stats_alloc (int);
-
/* Human friendly string for given byte count */
#define MTYPE_MEMSTR_LEN 20
extern const char *mtype_memstr (char *, size_t, unsigned long);