#include "dynarray.h"
#include "xmalloc.h"
+/* If the array becomes to small, increase its size by 100 entries */
+#define INCREASE_BY 100
+
struct pa_dynarray {
void **data;
unsigned n_allocated, n_entries;
if (!p)
return;
- n = i+100;
+ n = i+INCREASE_BY;
a->data = pa_xrealloc(a->data, sizeof(void*)*n);
memset(a->data+a->n_allocated, 0, sizeof(void*)*(n-a->n_allocated));
a->n_allocated = n;
assert(a);
if (i >= a->n_allocated)
return NULL;
+
assert(a->data);
return a->data[i];
}