diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2018-07-30 08:04:40 -0700 |
---|---|---|
committer | Neale Ranns <neale.ranns@cisco.com> | 2018-07-30 08:04:40 -0700 |
commit | c5d4317ad0425d01893dbb4afad9f16c2cde077d (patch) | |
tree | 2bbb6b86a5bf9f051cacc5065a6b6c58be7cbcb6 /src/vnet/fib/fib_entry.c | |
parent | 1f895c9a40f446ca9f1b7803f350c70ebb3ad0fa (diff) |
FIB: return entry prefix by const reference to avoid the copy
Change-Id: I09b8406168df4b6b28df3ede24ee839681be0195
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_entry.c')
-rw-r--r-- | src/vnet/fib/fib_entry.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c index a12edcb1867..655526586cb 100644 --- a/src/vnet/fib/fib_entry.c +++ b/src/vnet/fib/fib_entry.c @@ -1433,11 +1433,7 @@ fib_entry_get_best_source (fib_node_index_t entry_index) 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 @@ fib_entry_encode (fib_node_index_t fib_entry_index, } } -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 |