diff --git a/check_locking.c b/check_locking.c index 30a658d..595e422 100644 --- a/check_locking.c +++ b/check_locking.c @@ -354,7 +354,7 @@ static void do_unlock(const char *name) static void match_lock_held(const char *fn, struct expression *call_expr, struct expression *assign_expr, void *_index) { - int index = (int)_index; + int index = *(int*)_index; char *lock_name; struct lock_info *lock = &lock_table[index]; @@ -376,7 +376,7 @@ static void match_lock_held(const char *fn, struct expression *call_expr, static void match_lock_failed(const char *fn, struct expression *call_expr, struct expression *assign_expr, void *_index) { - int index = (int)_index; + int index = *(int*)_index; char *lock_name; struct lock_info *lock = &lock_table[index]; @@ -399,7 +399,7 @@ static void match_returns_locked(const char *fn, struct expression *expr, void *_index) { char *full_name = NULL; - int index = (int)_index; + int index = *(int*)_index; struct lock_info *lock = &lock_table[index]; if (lock->arg != RETURN_VAL) @@ -411,7 +411,7 @@ static void match_returns_locked(const char *fn, struct expression *expr, static void match_lock_unlock(const char *fn, struct expression *expr, void *_index) { char *full_name = NULL; - int index = (int)_index; + int index = *(int*)_index; struct lock_info *lock = &lock_table[index]; full_name = get_full_name(expr, index); @@ -624,7 +624,7 @@ static void match_func_end(struct symbol *sym) static void register_lock(int index) { struct lock_info *lock = &lock_table[index]; - void *idx = (void *)index; + void *idx = &index; if (lock->return_type == ret_non_zero) { return_implies_state(lock->function, 1, POINTER_MAX, &match_lock_held, idx); @@ -649,7 +649,7 @@ static void load_table(struct lock_info *_lock_table, int size) if (lock_table[i].action == LOCK) register_lock(i); else - add_function_hook(lock_table[i].function, &match_lock_unlock, (void *)i); + add_function_hook(lock_table[i].function, &match_lock_unlock, &i); } } diff --git a/check_unused_ret.c b/check_unused_ret.c index 2f277c2..94afb66 100644 --- a/check_unused_ret.c +++ b/check_unused_ret.c @@ -59,7 +59,7 @@ static struct smatch_state *my_alloc_state(int assign_id) snprintf(buff, 255, "assign_%d", assign_id); buff[255] = '\0'; state->name = alloc_string(buff); - state->data = (void *) assign_id; + state->data = &assign_id; return state; } @@ -122,7 +122,7 @@ static void delete_used_symbols(struct state_list *possible) struct sm_state *tmp; FOR_EACH_PTR(possible, tmp) { - delete_used((int)tmp->state->data); + delete_used(*(int*)tmp->state->data); } END_FOR_EACH_PTR(tmp); } diff --git a/smatch_extra.c b/smatch_extra.c index 45e8bf7..c094be6 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -12,7 +12,6 @@ */ #include -#define __USE_ISOC99 #include #include "parse.h" #include "smatch.h"