Move the array library into the data module.

This commit is contained in:
David Given 2016-09-26 22:24:49 +02:00
parent cc176e5183
commit 3671892c34
3 changed files with 3 additions and 3 deletions

View file

@ -16,6 +16,7 @@ cprogram {
"h+emheaders", "h+emheaders",
"modules+headers", "modules+headers",
"modules/src/alloc+lib", "modules/src/alloc+lib",
"modules/src/data+lib",
"modules/src/em_code+lib_k", "modules/src/em_code+lib_k",
"modules/src/em_data+lib", "modules/src/em_data+lib",
"modules/src/idf+lib", "modules/src/idf+lib",

View file

@ -1,4 +1,5 @@
#include "mcg.h" #include <stdlib.h>
#include <stdbool.h>
#include "array.h" #include "array.h"
void array_append(void*** array, int* count, int* max, void* value) 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); int newmax = (*max == 0) ? 8 : (*max * 2);
void** newarray = realloc(*array, newmax * sizeof(void*)); void** newarray = realloc(*array, newmax * sizeof(void*));
if (!newarray)
fatal("memory allocation failure");
*max = newmax; *max = newmax;
*array = newarray; *array = newarray;