FIB: return entry prefix by const reference to avoid the copy
Change-Id: I09b8406168df4b6b28df3ede24ee839681be0195
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index a12edcb..6555265 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -1433,11 +1433,7 @@
int
fib_entry_is_host (fib_node_index_t fib_entry_index)
{
- fib_prefix_t pfx;
-
- fib_entry_get_prefix(fib_entry_index, &pfx);
-
- return (fib_prefix_is_host(&pfx));
+ return (fib_prefix_is_host(fib_entry_get_prefix(fib_entry_index)));
}
/**
@@ -1612,14 +1608,14 @@
}
}
-void
-fib_entry_get_prefix (fib_node_index_t fib_entry_index,
- fib_prefix_t *pfx)
+const fib_prefix_t *
+fib_entry_get_prefix (fib_node_index_t fib_entry_index)
{
fib_entry_t *fib_entry;
fib_entry = fib_entry_get(fib_entry_index);
- *pfx = fib_entry->fe_prefix;
+
+ return (&fib_entry->fe_prefix);
}
u32