Message ID | 1470744173-8719-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
oops, only patch of patch here, will send v2. On 08/09/16 15:02, Maxim Uvarov wrote: > No need for prefix for not interface local static functions. > > Suggested-by: Anders Roxell <anders.roxell@linaro.org> > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > helper/hashtable.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/helper/hashtable.c b/helper/hashtable.c > index 8bb1ae5..9097c51 100644 > --- a/helper/hashtable.c > +++ b/helper/hashtable.c > @@ -164,7 +164,7 @@ odph_table_t odph_hash_table_lookup(const char *name) > * This hash algorithm is the most simple one, so we choose it as an DEMO > * User can use any other algorithm, like CRC... > */ > -uint16_t odp_key_hash(void *key, uint32_t key_size) > +static uint16_t key_hash(void *key, uint32_t key_size) > { > register uint32_t hash = 0; > uint32_t idx = (key_size == 0 ? 1 : key_size); > @@ -181,7 +181,7 @@ uint16_t odp_key_hash(void *key, uint32_t key_size) > /** > * Get an available node from pool > */ > -odph_hash_node *odp_hashnode_take(odph_table_t table) > +static odph_hash_node *hashnode_take(odph_table_t table) > { > odph_hash_table_imp *tbl = (odph_hash_table_imp *)table; > uint32_t idx; > @@ -208,7 +208,7 @@ odph_hash_node *odp_hashnode_take(odph_table_t table) > /** > * Release an node to the pool > */ > -void odp_hashnode_give(odph_table_t table, odph_hash_node *node) > +void odph_hashnode_give(odph_table_t table, odph_hash_node *node) > { > odph_hash_table_imp *tbl = (odph_hash_table_imp *)table; > > @@ -232,7 +232,7 @@ int odph_hash_put_value(odph_table_t table, void *key, void *value) > return ODPH_FAIL; > > /* hash value is just the index of the list head in pool */ > - hash = odp_key_hash(key, tbl->key_size); > + hash = key_hash(key, tbl->key_size); > > odp_rwlock_write_lock(&tbl->lock_pool[hash]); > /* First, check if the key already exist */ > @@ -249,7 +249,7 @@ int odph_hash_put_value(odph_table_t table, void *key, void *value) > } > > /*if the key is a new one, get a new hash node form the pool */ > - node = odp_hashnode_take(table); > + node = hashnode_take(table); > if (node == NULL) { > odp_rwlock_write_unlock(&tbl->lock_pool[hash]); > return ODPH_FAIL; > @@ -281,7 +281,7 @@ int odph_hash_get_value(odph_table_t table, void *key, void *buffer, > return ODPH_FAIL; > > /* hash value is just the index of the list head in pool */ > - hash = odp_key_hash(key, tbl->key_size); > + hash = key_hash(key, tbl->key_size); > > odp_rwlock_read_lock(&tbl->lock_pool[hash]); > > @@ -316,7 +316,7 @@ int odph_hash_remove_value(odph_table_t table, void *key) > return ODPH_FAIL; > > /* hash value is just the index of the list head in pool */ > - hash = odp_key_hash(key, tbl->key_size); > + hash = key_hash(key, tbl->key_size); > > odp_rwlock_write_lock(&tbl->lock_pool[hash]); > > @@ -324,7 +324,7 @@ int odph_hash_remove_value(odph_table_t table, void *key) > list_node) > { > if (memcmp(node->content, key, tbl->key_size) == 0) { > - odp_hashnode_give(table, node); > + odph_hashnode_give(table, node); > odp_rwlock_write_unlock(&tbl->lock_pool[hash]); > return ODPH_SUCCESS; > }
diff --git a/helper/hashtable.c b/helper/hashtable.c index 8bb1ae5..9097c51 100644 --- a/helper/hashtable.c +++ b/helper/hashtable.c @@ -164,7 +164,7 @@ odph_table_t odph_hash_table_lookup(const char *name) * This hash algorithm is the most simple one, so we choose it as an DEMO * User can use any other algorithm, like CRC... */ -uint16_t odp_key_hash(void *key, uint32_t key_size) +static uint16_t key_hash(void *key, uint32_t key_size) { register uint32_t hash = 0; uint32_t idx = (key_size == 0 ? 1 : key_size); @@ -181,7 +181,7 @@ uint16_t odp_key_hash(void *key, uint32_t key_size) /** * Get an available node from pool */ -odph_hash_node *odp_hashnode_take(odph_table_t table) +static odph_hash_node *hashnode_take(odph_table_t table) { odph_hash_table_imp *tbl = (odph_hash_table_imp *)table; uint32_t idx; @@ -208,7 +208,7 @@ odph_hash_node *odp_hashnode_take(odph_table_t table) /** * Release an node to the pool */ -void odp_hashnode_give(odph_table_t table, odph_hash_node *node) +void odph_hashnode_give(odph_table_t table, odph_hash_node *node) { odph_hash_table_imp *tbl = (odph_hash_table_imp *)table; @@ -232,7 +232,7 @@ int odph_hash_put_value(odph_table_t table, void *key, void *value) return ODPH_FAIL; /* hash value is just the index of the list head in pool */ - hash = odp_key_hash(key, tbl->key_size); + hash = key_hash(key, tbl->key_size); odp_rwlock_write_lock(&tbl->lock_pool[hash]); /* First, check if the key already exist */ @@ -249,7 +249,7 @@ int odph_hash_put_value(odph_table_t table, void *key, void *value) } /*if the key is a new one, get a new hash node form the pool */ - node = odp_hashnode_take(table); + node = hashnode_take(table); if (node == NULL) { odp_rwlock_write_unlock(&tbl->lock_pool[hash]); return ODPH_FAIL; @@ -281,7 +281,7 @@ int odph_hash_get_value(odph_table_t table, void *key, void *buffer, return ODPH_FAIL; /* hash value is just the index of the list head in pool */ - hash = odp_key_hash(key, tbl->key_size); + hash = key_hash(key, tbl->key_size); odp_rwlock_read_lock(&tbl->lock_pool[hash]); @@ -316,7 +316,7 @@ int odph_hash_remove_value(odph_table_t table, void *key) return ODPH_FAIL; /* hash value is just the index of the list head in pool */ - hash = odp_key_hash(key, tbl->key_size); + hash = key_hash(key, tbl->key_size); odp_rwlock_write_lock(&tbl->lock_pool[hash]); @@ -324,7 +324,7 @@ int odph_hash_remove_value(odph_table_t table, void *key) list_node) { if (memcmp(node->content, key, tbl->key_size) == 0) { - odp_hashnode_give(table, node); + odph_hashnode_give(table, node); odp_rwlock_write_unlock(&tbl->lock_pool[hash]); return ODPH_SUCCESS; }
No need for prefix for not interface local static functions. Suggested-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- helper/hashtable.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.7.1.250.gff4ea60