7 |
|
size_t item_size; |
8 |
|
int used_count; |
9 |
|
int alloc_count; |
10 |
+ |
int error; |
11 |
|
int block_size; |
12 |
|
vector_init_function init_fn; |
13 |
|
vector_destroy_function destroy_fn; |
18 |
|
sizeof(item_type), \ |
19 |
|
0, \ |
20 |
|
0, \ |
21 |
+ |
0, \ |
22 |
|
block_size, \ |
23 |
|
(vector_init_function) init_fn, \ |
24 |
|
(vector_destroy_function) destroy_fn \ |
25 |
|
} |
26 |
|
|
27 |
< |
int statgrab_vector_resize(char **vector, vector_header *h, int count); |
27 |
> |
/* Internal function to resize the vector. */ |
28 |
> |
void *statgrab_vector_resize(void *vector, vector_header *h, int count); |
29 |
|
|
30 |
|
/* Declare a vector. Specify the init/destroy functions as NULL if you don't |
31 |
|
* need them. The block size is how many items to allocate at once. */ |
46 |
|
* out-of-memory, the old contents of the vector will be destroyed and the old |
47 |
|
* vector will be freed. */ |
48 |
|
#define VECTOR_RESIZE(name, num_items) \ |
49 |
< |
statgrab_vector_resize((char **) &name, &name##_header, num_items) |
49 |
> |
(name = statgrab_vector_resize((char *) name, &name##_header, num_items), \ |
50 |
> |
name##_header.error) |
51 |
|
|
52 |
|
/* Free a vector, destroying its contents. */ |
53 |
|
#define VECTOR_FREE(name) \ |