Move the array library into the data module.
authorDavid Given <dg@cowlark.com>
Mon, 26 Sep 2016 20:24:49 +0000 (22:24 +0200)
committerDavid Given <dg@cowlark.com>
Mon, 26 Sep 2016 20:24:49 +0000 (22:24 +0200)
mach/proto/mcg/build.lua
modules/src/data/array.c [moved from mach/proto/mcg/array.c with 93% similarity]
modules/src/data/array.h [moved from mach/proto/mcg/array.h with 100% similarity]

index b9440a7..dc35042 100644 (file)
@@ -16,6 +16,7 @@ cprogram {
                "h+emheaders",
                "modules+headers",
                "modules/src/alloc+lib",
+               "modules/src/data+lib",
                "modules/src/em_code+lib_k",
                "modules/src/em_data+lib",
                "modules/src/idf+lib",
similarity index 93%
rename from mach/proto/mcg/array.c
rename to modules/src/data/array.c
index a375baf..9f61d28 100644 (file)
@@ -1,4 +1,5 @@
-#include "mcg.h"
+#include <stdlib.h>
+#include <stdbool.h>
 #include "array.h"
 
 void array_append(void*** array, int* count, int* max, void* value)
@@ -7,8 +8,6 @@ void array_append(void*** array, int* count, int* max, void* value)
        {
                int newmax = (*max == 0) ? 8 : (*max * 2);
                void** newarray = realloc(*array, newmax * sizeof(void*));
-               if (!newarray)
-                       fatal("memory allocation failure");
 
                *max = newmax;
                *array = newarray;