summaryrefslogtreecommitdiffstats
path: root/libdimension/map.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-06-24 16:21:58 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-06-24 16:22:31 -0400
commit537b7695c26b9ad83ccc13b68c78a2fb27545d7e (patch)
treea801d360354343b92600df3e3eb255ff87ab8487 /libdimension/map.c
parent77237a2e22acfc3f8a028cd1a4d63b602cbbf45e (diff)
downloaddimension-537b7695c26b9ad83ccc13b68c78a2fb27545d7e.tar.xz
Fix some warnings found by clang.
Diffstat (limited to 'libdimension/map.c')
-rw-r--r--libdimension/map.c14
1 files changed, 7 insertions, 7 deletions
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;