diff options
author | paul <paul> | 2004-10-10 13:56:56 +0200 |
---|---|---|
committer | paul <paul> | 2004-10-10 13:56:56 +0200 |
commit | 9035efaa924c69f4f4fcb1049c7dc4f43b9da980 (patch) | |
tree | f81d25b0e069ad8fb5f2843172a4e60fa0d6cbdf /lib/distribute.c | |
parent | 2004-10-10 Paul Jakma <paul@dishone.st> (diff) | |
download | frr-9035efaa924c69f4f4fcb1049c7dc4f43b9da980.tar.xz frr-9035efaa924c69f4f4fcb1049c7dc4f43b9da980.zip |
2004-10-10 Paul Jakma <paul@dishone.st>
* version.h.in: (pid_output*) add const qualifier.
* command.h: Change DEFUN func to take const char *[] rather
than char **, to begin process of fixing compile warnings in lib/.
Nearly all other changes in this commit follow from this change.
* buffer.{c,h}: (buffer_write) pointer-arithmetic is gccism, take
const void * and cast an automatic const char *p to it.
(buffer_putstr) add const
* command.c: (zencrypt) const qualifier
(cmd_execute_command_real) ditto
(cmd_execute_command_strict) ditto
(config_log_file) ditto.
Fix leak of getcwd() returned string.
* memory.{c,h}: Add MTYPE_DISTRIBUTE_IFNAME for struct dist ifname.
* distribute.{c,h}: Update with const qualifier.
(distribute_free) use MTYPE_DISTRIBUTE_IFNAME
(distribute_lookup) Cast to char *, note that it's ok.
(distribute_hash_alloc) use MTYPE_DISTRIBUTE_IFNAME.
(distribute_get) Cast to char *, note that it's ok.
* filter.c: Update with const qualifier.
* if.{c,h}: ditto.
* if_rmap.{c,h}: ditto.
(if_rmap_lookup) Cast to char *, note that it's ok.
(if_rmap_get) ditto.
* log.{c,h}: Update with const qualifier.
* plist.{c,h}: ditto.
* routemap.{c,h}: ditto.
* smux.{c,h}: ditto. Fix some signed/unsigned comparisons.
* sockopt.c: (getsockopt_cmsg_data) add return for error case.
* vty.c: Update with const qualifier.
Diffstat (limited to 'lib/distribute.c')
-rw-r--r-- | lib/distribute.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/distribute.c b/lib/distribute.c index 78de4bfbc..48eb0403f 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -51,7 +51,7 @@ void distribute_free (struct distribute *dist) { if (dist->ifname) - free (dist->ifname); + XFREE (MTYPE_DISTRIBUTE_IFNAME, dist->ifname); if (dist->list[DISTRIBUTE_IN]) free (dist->list[DISTRIBUTE_IN]); @@ -68,12 +68,13 @@ distribute_free (struct distribute *dist) /* Lookup interface's distribute list. */ struct distribute * -distribute_lookup (char *ifname) +distribute_lookup (const char *ifname) { struct distribute key; struct distribute *dist; - key.ifname = ifname; + /* temporary reference */ + key.ifname = (char *)ifname; dist = hash_lookup (disthash, &key); @@ -99,7 +100,7 @@ distribute_hash_alloc (struct distribute *arg) dist = distribute_new (); if (arg->ifname) - dist->ifname = strdup (arg->ifname); + dist->ifname = XSTRDUP (MTYPE_DISTRIBUTE_IFNAME, arg->ifname); else dist->ifname = NULL; return dist; @@ -107,12 +108,13 @@ distribute_hash_alloc (struct distribute *arg) /* Make new distribute list and push into hash. */ struct distribute * -distribute_get (char *ifname) +distribute_get (const char *ifname) { struct distribute key; - key.ifname = ifname; - + /* temporary reference */ + key.ifname = (char *)ifname; + return hash_get (disthash, &key, distribute_hash_alloc); } @@ -144,7 +146,8 @@ distribute_cmp (struct distribute *dist1, struct distribute *dist2) /* Set access-list name to the distribute list. */ struct distribute * -distribute_list_set (char *ifname, enum distribute_type type, char *alist_name) +distribute_list_set (const char *ifname, enum distribute_type type, + const char *alist_name) { struct distribute *dist; @@ -172,8 +175,8 @@ distribute_list_set (char *ifname, enum distribute_type type, char *alist_name) /* Unset distribute-list. If matched distribute-list exist then return 1. */ int -distribute_list_unset (char *ifname, enum distribute_type type, - char *alist_name) +distribute_list_unset (const char *ifname, enum distribute_type type, + const char *alist_name) { struct distribute *dist; @@ -221,8 +224,8 @@ distribute_list_unset (char *ifname, enum distribute_type type, /* Set access-list name to the distribute list. */ struct distribute * -distribute_list_prefix_set (char *ifname, enum distribute_type type, - char *plist_name) +distribute_list_prefix_set (const char *ifname, enum distribute_type type, + const char *plist_name) { struct distribute *dist; @@ -250,8 +253,8 @@ distribute_list_prefix_set (char *ifname, enum distribute_type type, /* Unset distribute-list. If matched distribute-list exist then return 1. */ int -distribute_list_prefix_unset (char *ifname, enum distribute_type type, - char *plist_name) +distribute_list_prefix_unset (const char *ifname, enum distribute_type type, + const char *plist_name) { struct distribute *dist; |