summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-05-07 16:53:05 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-05-22 20:25:50 +0200
commit558d1fec11749d3257e32561d45b5c1ec0622cf4 (patch)
tree4570b1643db6446dc9f14f9c0bf7fd64a3325117 /bgpd/bgp_attr.c
parent489d005a9ad94675f40dc7bceff6176cfad36d45 (diff)
bgpd: reduce struct attr_extra allocations/freeing
Try to use on stack structs for temporary uses. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index b63ac4c8..2d82acc2 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -319,10 +319,14 @@ bgp_attr_extra_get (struct attr *attr)
void
bgp_attr_dup (struct attr *new, struct attr *orig)
{
+ struct attr_extra *extra = new->extra;
+
*new = *orig;
if (orig->extra)
{
- new->extra = bgp_attr_extra_new();
+ /* if caller provided attr_extra space use it */
+ if (! extra)
+ new->extra = bgp_attr_extra_new();
*new->extra = *orig->extra;
}
}