From fd79ac918b8feaacebe9719adaac97dffb69137a Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 13 Oct 2004 05:06:08 +0000 Subject: 2004-10-13 Paul Jakma * (global) more const'ification and fixups of types to clean up code. * bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect, should use something like the VTY_GET_INTEGER macro, but without the vty_out bits.. * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE (no_set_aggregator_as) ditto. * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is returned, add comments about troublesome return value. --- bgpd/bgp_ecommunity.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'bgpd/bgp_ecommunity.c') diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index b3fc1c3a..32bf68f1 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -245,7 +245,8 @@ ecommunity_hash_make (struct ecommunity *ecom) /* Compare two Extended Communities Attribute structure. */ int -ecommunity_cmp (struct ecommunity *ecom1, struct ecommunity *ecom2) +ecommunity_cmp (const struct ecommunity *ecom1, + const struct ecommunity *ecom2) { if (ecom1->size == ecom2->size && memcmp (ecom1->val, ecom2->val, ecom1->size * ECOMMUNITY_SIZE) == 0) @@ -270,8 +271,8 @@ enum ecommunity_token }; /* Get next Extended Communities token from the string. */ -char * -ecommunity_gettoken (char *str, struct ecommunity_val *eval, +const char * +ecommunity_gettoken (const char *str, struct ecommunity_val *eval, enum ecommunity_token *token) { int ret; @@ -280,7 +281,7 @@ ecommunity_gettoken (char *str, struct ecommunity_val *eval, int separator = 0; u_int32_t val_low = 0; u_int32_t val_high = 0; - char *p = str; + const char *p = str; struct in_addr ip; char ipstr[INET_ADDRSTRLEN + 1]; @@ -448,7 +449,7 @@ ecommunity_gettoken (char *str, struct ecommunity_val *eval, keyword_include = 1 */ struct ecommunity * -ecommunity_str2com (char *str, int type, int keyword_included) +ecommunity_str2com (const char *str, int type, int keyword_included) { struct ecommunity *ecom = NULL; enum ecommunity_token token; @@ -537,7 +538,7 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format) int str_size; int str_pnt; char *str_buf; - char *prefix; + const char *prefix; int len = 0; int first = 1; @@ -650,7 +651,8 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format) } int -ecommunity_match (struct ecommunity *ecom1, struct ecommunity *ecom2) +ecommunity_match (const struct ecommunity *ecom1, + const struct ecommunity *ecom2) { int i = 0; int j = 0; -- cgit v1.2.3