summaryrefslogtreecommitdiff
path: root/bgpd/bgp_aspath.h
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-05-07 16:52:51 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-05-22 20:25:02 +0200
commitf669f7d25f0f491d5e487897227ff434aef20406 (patch)
tree4b040b835be1d47b7eca7240b7d7aa4b9e6f177b /bgpd/bgp_aspath.h
parent8692c506520f6b268525b80890702432c95f13c4 (diff)
bgpd: optimize aspath string representation and assegments handling
* bgp_aspath.h: Add str_len to struct aspath. * bgp_aspath.c: Save the aspath string representation length and use it instead of strlen(). (aspath_make_str_count) assign the string buffer directly for consistency with the string length and change the return type to void. (aspath_dup) use str_len and copy the string instead of calling aspath_make_str_count(). (assegment_data_new) change from XCALLOC to XMALLOC. All users initialize the memory before use. (assegment_data_free) unused, removed. (aspath_intern) check that there's always a ->str pointer. (aspath_hash_alloc) reuse assegments and string representation instead of copying them. (aspath_parse) now aspath_hash_alloc does not dupes memory, free the temporary structures only if the aspath it is in the hash. (aspath_cmp_left) remove useless NULL initialization. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_aspath.h')
-rw-r--r--bgpd/bgp_aspath.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h
index fc4dd6b7..e8764cca 100644
--- a/bgpd/bgp_aspath.h
+++ b/bgpd/bgp_aspath.h
@@ -58,6 +58,7 @@ struct aspath
/* String expression of AS path. This string is used by vty output
and AS path regular expression match. */
char *str;
+ unsigned short str_len;
};
#define ASPATH_STR_DEFAULT_LEN 32