Browse Source

mingw compatability

master
alistair 4 years ago
parent
commit
f3d3d3c18a
  1. 6
      datatypes.c
  2. 1
      datatypes.h

6
datatypes.c

@ -75,7 +75,8 @@ void * arlst_del(ArrayList *l, int id) { @@ -75,7 +75,8 @@ void * arlst_del(ArrayList *l, int id) {
size_t new_size = l-> size + (l->capacity * (100 / D_SHRINK_THRESHOLD) *
100 / D_GROW_AMOUNT);
l->items = reallocarray(l->items, new_size, sizeof(void *));
// l->items = reallocarray(l->items, new_size, sizeof(void *));
l->items = realloc(l->items, new_size * sizeof(void *));
}
return item;
@ -88,7 +89,8 @@ int arlst_add(ArrayList *l, void *item) { @@ -88,7 +89,8 @@ int arlst_add(ArrayList *l, void *item) {
if (l->size == l->capacity) {
size_t new_size = l->capacity + (100 / D_GROW_AMOUNT) * l->capacity;
l->capacity = new_size;
l->items = (void **)reallocarray(l->items, new_size, sizeof(void *));
//l->items = (void **)reallocarray(l->items, new_size, sizeof(void *));
l->items = (void **)realloc(l->items, new_size * sizeof(void *));
}
l->items[item_index] = item;

1
datatypes.h

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
#ifndef DTYPE_H
#define DTYPE_H
#include <stdlib.h>
enum {

Loading…
Cancel
Save