Add -Wextra compiler flag

This commit is contained in:
2022-11-16 23:06:44 -05:00
parent c67d4f4583
commit e1048c3ca4
3 changed files with 5 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ struct ucl_arena *ucl_arena_create(size_t object_size, size_t capacity) {
void ucl_arena_map(struct ucl_arena *arena, void (*map_function)(struct ucl_arena * arena, void *object)) {
size_t used_map_ints = DIV_ROUND_UP(arena->capacity, INT_BITS);
for (int i = 0; i < used_map_ints; i++ ) {
for (unsigned int i = 0; i < used_map_ints; i++ ) {
// TODO: Allow for 'put' in map
int map = arena->used_map[i];
while (map) {
@@ -60,8 +60,8 @@ void *ucl_arena_get(struct ucl_arena *arena) {
continue;
}
int bit_index = __builtin_ffs(~map) - 1;
int index = bit_index + INT_BITS * i;
unsigned int bit_index = __builtin_ffs(~map) - 1;
unsigned int index = bit_index + INT_BITS * i;
if (index >= arena->capacity) {
// This might happen in the last used_map_int when (capacity % int_bits != 0)
return NULL;
@@ -88,7 +88,6 @@ void ucl_arena_put(struct ucl_arena *arena, void *object) {
unsigned int bit_index = index % INT_BITS;
assert(offset % arena->object_size == 0);
assert(index >= 0);
assert(index < arena->capacity);
assert(arena->used_map[int_index] & (1 << bit_index));

View File

@@ -127,7 +127,7 @@ struct ucl_object *ucl_parse_token_atom(struct ucl_object *maybe_atom) {
break;
case UCL_TYPE_SYMBOL: {
// Check for reserved tokens first, which indicate special, non-atom behavior
for (int i = 0; i < ARRAY_SIZE(reserved_symbols); i++) {
for (unsigned int i = 0; i < ARRAY_SIZE(reserved_symbols); i++) {
if (!strcmp(maybe_atom->string, reserved_symbols[i])) {
return NULL;
}