Mercurial > code
comparison parray.c @ 93:9ebea85c7765
Use pointer instead of copying variable in ARRAY_FOREACH, then you can modify it
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 04 Jan 2012 13:21:15 +0100 |
parents | 4d723e81b685 |
children | b1a084c030c8 |
comparison
equal
deleted
inserted
replaced
92:4d723e81b685 | 93:9ebea85c7765 |
---|---|
25 #define LENGTH(x) ((x) * (sizeof (void *))) | 25 #define LENGTH(x) ((x) * (sizeof (void *))) |
26 | 26 |
27 static int parray_grow(struct parray *); | 27 static int parray_grow(struct parray *); |
28 | 28 |
29 int | 29 int |
30 parray_new(struct parray *arr) | 30 parray_init(struct parray *arr) |
31 { | 31 { |
32 /* Set defaults if needed */ | 32 /* Set defaults if needed */ |
33 arr->bsize = (arr->bsize <= 0) ? PARRAY_DEFAULT_BSIZE : arr->bsize; | 33 arr->bsize = (arr->bsize <= 0) ? PARRAY_DEFAULT_BSIZE : arr->bsize; |
34 arr->malloc = (arr->malloc == NULL) ? &malloc : arr->malloc; | 34 arr->malloc = (arr->malloc == NULL) ? &malloc : arr->malloc; |
35 arr->realloc = (arr->realloc == NULL) ? &realloc : arr->realloc; | 35 arr->realloc = (arr->realloc == NULL) ? &realloc : arr->realloc; |