bgpd: avoid recalculating as_val value in str2prefix_rd

This is an optimisation that consists in avoiding calling twice atol()
function when converting an ext. community to an AS4 byte or a standard AS byte value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2017-01-17 17:51:40 +01:00
parent cc5eb67752
commit bac21a7c4b

View File

@ -346,13 +346,13 @@ str2prefix_rd (const char *str, struct prefix_rd *prd)
if (as_val > 0xffff)
{
stream_putw (s, RD_TYPE_AS4);
stream_putl (s, atol (half));
stream_putl (s, as_val);
stream_putw (s, atol (p + 1));
}
else
{
stream_putw (s, RD_TYPE_AS);
stream_putw (s, atol (half));
stream_putw (s, as_val);
stream_putl (s, atol (p + 1));
}
}