diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/command.c | 10 | ||||
-rw-r--r-- | lib/memory.h | 7 | ||||
-rw-r--r-- | lib/prefix.c | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/lib/command.c b/lib/command.c index 6fe54d13..a78ac05c 100644 --- a/lib/command.c +++ b/lib/command.c @@ -86,7 +86,7 @@ static struct cmd_node config_node = }; /* Default motd string. */ -const char *default_motd = +static const char *default_motd = "\r\n\ Hello, this is " QUAGGA_PROGNAME " (version " QUAGGA_VERSION ").\r\n\ " QUAGGA_COPYRIGHT "\r\n\ @@ -98,7 +98,7 @@ const char *debug_banner = __DATE__ " " __TIME__; #endif -static struct facility_map { +static const struct facility_map { int facility; const char *name; size_t match; @@ -131,7 +131,7 @@ static struct facility_map { static const char * facility_name(int facility) { - struct facility_map *fm; + const struct facility_map *fm; for (fm = syslog_facilities; fm->name; fm++) if (fm->facility == facility) @@ -142,7 +142,7 @@ facility_name(int facility) static int facility_match(const char *str) { - struct facility_map *fm; + const struct facility_map *fm; for (fm = syslog_facilities; fm->name; fm++) if (!strncmp(str,fm->name,fm->match)) @@ -665,7 +665,7 @@ install_element (enum node_type ntype, struct cmd_element *cmd) cmd->cmdsize = cmd_cmdsize (cmd->strvec); } -static unsigned char itoa64[] = +static const unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static void diff --git a/lib/memory.h b/lib/memory.h index 5fa5c5ac..d67e865b 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -48,7 +48,10 @@ extern struct mlist mlists[]; #define XREALLOC(mtype, ptr, size) \ mtype_zrealloc (__FILE__, __LINE__, (mtype), (ptr), (size)) #define XFREE(mtype, ptr) \ - mtype_zfree (__FILE__, __LINE__, (mtype), (ptr)) + do { \ + mtype_zfree (__FILE__, __LINE__, (mtype), (ptr)); \ + ptr = NULL; } \ + while (0) #define XSTRDUP(mtype, str) \ mtype_zstrdup (__FILE__, __LINE__, (mtype), (str)) #else @@ -92,7 +95,7 @@ extern void *mtype_zmalloc (const char *file, int line, enum MTYPE type, size_t size); extern void *mtype_zcalloc (const char *file, int line, enum MTYPE type, - size_t num, size_t size); + size_t size); extern void *mtype_zrealloc (const char *file, int line, enum MTYPE type, void *ptr, size_t size); diff --git a/lib/prefix.c b/lib/prefix.c index 7755d4e7..9b5c9a7a 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -29,8 +29,8 @@ #include "log.h" /* Maskbit. */ -static u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, - 0xf8, 0xfc, 0xfe, 0xff}; +static const u_char maskbit[] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff }; /* Number of bits in prefix type. */ #ifndef PNBBY |