2004-10-13 Paul Jakma <paul@dishone.st>
* (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.
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index b3fc1c3..32bf68f 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -245,7 +245,8 @@
/* 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 @@
};
/* 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 @@
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 @@
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 @@
int str_size;
int str_pnt;
char *str_buf;
- char *prefix;
+ const char *prefix;
int len = 0;
int first = 1;
@@ -650,7 +651,8 @@
}
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;