summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-29 15:23:11 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-29 15:23:11 -0700
commitad1ea7f47cb37212105e910db8c71ba5525cd8b9 (patch)
treefe085da8ae5ad6ec02255c1c51b75ead90a909f7
parent0e635a25c5c5bbedd068f78a14008dc021dd196a (diff)
downloadvyatta-cfg-ad1ea7f47cb37212105e910db8c71ba5525cd8b9.tar.gz
vyatta-cfg-ad1ea7f47cb37212105e910db8c71ba5525cd8b9.zip
Turn my_wrappers into macros
The my_malloc() etc wrappers can be shrunk by using macros.
-rw-r--r--src/cli_new.c30
-rw-r--r--src/cli_val.h10
2 files changed, 7 insertions, 33 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index c1f5aac..83cc150 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -2074,35 +2074,7 @@ int cli_val_read(char *buf, int max_size)
}
return len;
}
-/*==========================================================*/
-/* MEMORY */
-/*==========================================================*/
-
-void *my_malloc(size_t size, const char *name)
-{
- return malloc(size);
-}
-void *my_realloc(void *ptr, size_t size, const char *name)
-{
- return realloc(ptr, size);
-}
-
-void my_free(void *ptr)
-{
- free(ptr);
-}
-
-/*************************************************
- my_strdup:
- do a strdup,
- exit on no memory
-**************************************************/
-char *my_strdup(const char *s, const char *name)
-{
- return strdup(s);
-}
-
-void done()
+void done(void)
{
free_reuse_list();
free_path(&t_path);
diff --git a/src/cli_val.h b/src/cli_val.h
index 917f374..5abaaee 100644
--- a/src/cli_val.h
+++ b/src/cli_val.h
@@ -156,8 +156,6 @@ extern void push_path(vtw_path *path, char *segm);
extern void push_path_no_escape(vtw_path *path, char *segm);
extern void free_def(vtw_def *defp);
extern void free_sorted(vtw_sorted *sortp);
-extern void *my_malloc(size_t size, const char *name);
-extern void *my_realloc(void *ptr, size_t size, const char *name);
extern vtw_path m_path, t_path;
@@ -167,7 +165,6 @@ extern vtw_path m_path, t_path;
extern void add_val(valstruct *first, valstruct *second);
extern int cli_val_read(char *buf, int max_size);
extern vtw_node *make_val_node(valstruct *val);
-extern char *my_strdup(const char *s, const char *name);
extern valstruct str2val(char *cp);
extern void dump_tree(vtw_node *node, int lev);
extern void dump_def(vtw_def *defp);
@@ -188,7 +185,6 @@ extern void print_msg(const char *msg, ...)
extern void switch_path(first_seg *seg);
extern void vtw_sort(valstruct *valp, vtw_sorted *sortp);
extern void free_val(valstruct *val);
-extern void my_free(void *ptr);
extern void touch(void);
extern int mkdir_p(const char *path);
@@ -225,6 +221,12 @@ extern FILE *err_stream;
extern int initialize_output(void);
+/* debug hooks? */
+#define my_malloc(size, name) malloc(size)
+#define my_realloc(ptr, size, name) realloc(ptr, size)
+#define my_strdup(str, name) strdup(str)
+#define my_free(ptr) free(ptr)
+
/*** debug ***/
#undef CLI_DEBUG
#ifdef CLI_DEBUG