neigh_cache: make neigh_cache_lookup_entry static

The function neigh_cache_lookup_entry() is only used from within
neigh_cache.c. Let's make it static and move it, so that we do not need
the prototype declaration.

Change-Id: I1ea72ad9c79bfeaa06391cf8f62b284fbfea8efc
This commit is contained in:
Philipp Maier 2023-07-03 12:46:59 +02:00
parent e4e53adc9c
commit c46b6f29f9
2 changed files with 20 additions and 22 deletions

View File

@ -89,6 +89,26 @@ void neigh_cache_set_keep_time_interval(struct neigh_cache *cache, unsigned int
neigh_cache_schedule_cleanup(cache);
}
static struct neigh_cache_entry *neigh_cache_lookup_entry(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key)
{
struct neigh_cache_entry *tmp;
llist_for_each_entry(tmp, &cache->list, list) {
if (neigh_cache_entry_key_eq(&tmp->key, key))
return tmp;
}
return NULL;
}
const struct osmo_cell_global_id_ps *neigh_cache_lookup_value(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key)
{
struct neigh_cache_entry *it = neigh_cache_lookup_entry(cache, key);
if (it)
return &it->value;
return NULL;
}
struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key,
const struct osmo_cell_global_id_ps *value)
@ -119,26 +139,6 @@ struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache,
return it;
}
struct neigh_cache_entry *neigh_cache_lookup_entry(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key)
{
struct neigh_cache_entry *tmp;
llist_for_each_entry(tmp, &cache->list, list) {
if (neigh_cache_entry_key_eq(&tmp->key, key))
return tmp;
}
return NULL;
}
const struct osmo_cell_global_id_ps *neigh_cache_lookup_value(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key)
{
struct neigh_cache_entry *it = neigh_cache_lookup_entry(cache, key);
if (it)
return &it->value;
return NULL;
}
void neigh_cache_free(struct neigh_cache *cache)
{
struct neigh_cache_entry *it, *tmp;

View File

@ -65,8 +65,6 @@ void neigh_cache_set_keep_time_interval(struct neigh_cache *cache, unsigned int
struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key,
const struct osmo_cell_global_id_ps *value);
struct neigh_cache_entry *neigh_cache_lookup_entry(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key);
const struct osmo_cell_global_id_ps *neigh_cache_lookup_value(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key);
void neigh_cache_free(struct neigh_cache *cache);