Move the array library into the data module.
This commit is contained in:
parent
cc176e5183
commit
3671892c34
|
@ -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",
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in a new issue