From 537b7695c26b9ad83ccc13b68c78a2fb27545d7e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 24 Jun 2014 16:21:58 -0400 Subject: Fix some warnings found by clang. --- libdimension/map.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libdimension/map.c') diff --git a/libdimension/map.c b/libdimension/map.c index 1ae2a10..f5454b1 100644 --- a/libdimension/map.c +++ b/libdimension/map.c @@ -23,7 +23,7 @@ * Generic maps. */ -#include "dimension.h" +#include "dimension-internal.h" /// dmnsn_map definition. struct dmnsn_map { @@ -49,8 +49,9 @@ dmnsn_new_map(dmnsn_pool *pool, size_t size) void dmnsn_map_add_entry(dmnsn_map *map, double n, const void *obj) { - char mem[sizeof(dmnsn_map_entry) + map->obj_size]; - dmnsn_map_entry *entry = (dmnsn_map_entry *)mem; + dmnsn_map_entry *entry; + DMNSN_ALLOCA(entry, sizeof(dmnsn_map_entry) + map->obj_size); + entry->n = n; memcpy(entry->object, obj, map->obj_size); @@ -91,11 +92,10 @@ dmnsn_map_evaluate(const dmnsn_map *map, double n, return; } - const dmnsn_map_entry *last = dmnsn_array_last(map->array); ptrdiff_t skip = sizeof(dmnsn_map_entry) + map->obj_size; - for (; entry <= last; - entry = (const dmnsn_map_entry *)((const char *)entry + skip)) - { + for (const dmnsn_map_entry *last = dmnsn_array_last(map->array); + entry <= last; + entry = (const dmnsn_map_entry *)((const char *)entry + skip)) { n1 = n2; o1 = o2; -- cgit v1.2.3