diff options
Diffstat (limited to 'src/ptrarray.h')
| -rw-r--r-- | src/ptrarray.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ptrarray.h b/src/ptrarray.h new file mode 100644 index 0000000..84f9ef0 --- /dev/null +++ b/src/ptrarray.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | /* | ||
| 2 | * ptrarray.h | ||
| 3 | * header file for simple pointer array implementation | ||
| 4 | * | ||
| 5 | * Copyright (c) 2011 Nikias Bassen, All Rights Reserved. | ||
| 6 | * | ||
| 7 | * This library is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU Lesser General Public | ||
| 9 | * License as published by the Free Software Foundation; either | ||
| 10 | * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This library is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * Lesser General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU Lesser General Public | ||
| 18 | * License along with this library; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | #ifndef PTRARRAY_H | ||
| 22 | #define PTRARRAY_H | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include "common.h" | ||
| 25 | |||
| 26 | typedef struct ptrarray_t { | ||
| 27 | void **pdata; | ||
| 28 | size_t len; | ||
| 29 | size_t capacity; | ||
| 30 | size_t capacity_step; | ||
| 31 | } ptrarray_t; | ||
| 32 | |||
| 33 | _PLIST_INTERNAL ptrarray_t *ptr_array_new(int capacity); | ||
| 34 | _PLIST_INTERNAL void ptr_array_free(ptrarray_t *pa); | ||
| 35 | _PLIST_INTERNAL void ptr_array_add(ptrarray_t *pa, void *data); | ||
| 36 | _PLIST_INTERNAL void* ptr_array_index(ptrarray_t *pa, size_t index); | ||
| 37 | #endif | ||
