aboutsummaryrefslogtreecommitdiff
path: root/helper/lineartable.c
diff options
context:
space:
mode:
authorMaxim Uvarov <maxim.uvarov@linaro.org>2017-01-27 18:19:14 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2017-01-27 21:38:38 +0300
commit7df357dd591cce23f76221945091a019c0caa7ec (patch)
treef84dde4cace5e06a5333fe840be70a13ea3ea095 /helper/lineartable.c
parenta51c171ebe9e9b0aaced13bc0956bdb38c8cfc7b (diff)
helper: fix compilation with warnings
After turning on lost CFLAGS for checking errors, following things needs to be corrected to make code compile. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org>
Diffstat (limited to 'helper/lineartable.c')
-rw-r--r--helper/lineartable.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/helper/lineartable.c b/helper/lineartable.c
index 891790144..e1a396c19 100644
--- a/helper/lineartable.c
+++ b/helper/lineartable.c
@@ -41,9 +41,10 @@ typedef struct {
*/
odph_table_t odph_linear_table_create(const char *name, uint32_t capacity,
- uint32_t ODP_IGNORED, uint32_t value_size)
+ uint32_t un ODPH_UNUSED,
+ uint32_t value_size)
{
- int idx;
+ uint32_t idx;
uint32_t node_num;
odp_shm_t shmem;
odph_linear_table_imp *tbl;
@@ -90,8 +91,10 @@ odph_table_t odph_linear_table_create(const char *name, uint32_t capacity,
/* initialize rwlock*/
for (idx = 0; idx < tbl->node_sum; idx++) {
- odp_rwlock_t *lock = (odp_rwlock_t *)((char *)tbl->value_array
- + idx * tbl->value_size);
+ odp_rwlock_t *lock;
+
+ lock = (odp_rwlock_t *)(void *)((char *)tbl->value_array
+ + idx * tbl->value_size);
odp_rwlock_init(lock);
}
@@ -106,7 +109,7 @@ int odph_linear_table_destroy(odph_table_t table)
odph_linear_table_imp *linear_tbl = NULL;
if (table != NULL) {
- linear_tbl = (odph_linear_table_imp *)table;
+ linear_tbl = (odph_linear_table_imp *)(void *)table;
/* check magicword, make sure the memory is used by a table */
if (linear_tbl->magicword != ODPH_LINEAR_TABLE_MAGIC_WORD)
@@ -142,9 +145,10 @@ odph_table_t odph_linear_table_lookup(const char *name)
}
/* should make sure the input table exists and is available */
-int odph_lineartable_put_value(odph_table_t table, void *key, void *value)
+static int odph_lineartable_put_value(odph_table_t table,
+ void *key, void *value)
{
- odph_linear_table_imp *tbl = (odph_linear_table_imp *)table;
+ odph_linear_table_imp *tbl;
uint32_t ikey = 0;
void *entry = NULL;
odp_rwlock_t *lock = NULL;
@@ -152,6 +156,7 @@ int odph_lineartable_put_value(odph_table_t table, void *key, void *value)
if (table == NULL || key == NULL || value == NULL)
return ODPH_FAIL;
+ tbl = (odph_linear_table_imp *)(void *)table;
ikey = *(uint32_t *)key;
if (ikey >= tbl->node_sum)
return ODPH_FAIL;
@@ -170,10 +175,11 @@ int odph_lineartable_put_value(odph_table_t table, void *key, void *value)
}
/* should make sure the input table exists and is available */
-int odph_lineartable_get_value(odph_table_t table, void *key, void *buffer,
- uint32_t buffer_size)
+static int odph_lineartable_get_value(odph_table_t table,
+ void *key, void *buffer,
+ uint32_t buffer_size ODPH_UNUSED)
{
- odph_linear_table_imp *tbl = (odph_linear_table_imp *)table;
+ odph_linear_table_imp *tbl;
uint32_t ikey = 0;
void *entry = NULL;
odp_rwlock_t *lock = NULL;
@@ -181,6 +187,7 @@ int odph_lineartable_get_value(odph_table_t table, void *key, void *buffer,
if (table == NULL || key == NULL || buffer == NULL)
return ODPH_FAIL;
+ tbl = (odph_linear_table_imp *)(void *)table;
ikey = *(uint32_t *)key;
if (ikey >= tbl->node_sum)
return ODPH_FAIL;