|
Packit |
da78c2 |
/*
|
|
Packit |
da78c2 |
* ptrarray.h
|
|
Packit |
da78c2 |
* header file for simple pointer array implementation
|
|
Packit |
da78c2 |
*
|
|
Packit |
da78c2 |
* Copyright (c) 2011 Nikias Bassen, All Rights Reserved.
|
|
Packit |
da78c2 |
*
|
|
Packit |
da78c2 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
da78c2 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
da78c2 |
* License as published by the Free Software Foundation; either
|
|
Packit |
da78c2 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
da78c2 |
*
|
|
Packit |
da78c2 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
da78c2 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
da78c2 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
da78c2 |
* Lesser General Public License for more details.
|
|
Packit |
da78c2 |
*
|
|
Packit |
da78c2 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
da78c2 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
da78c2 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
da78c2 |
*/
|
|
Packit |
da78c2 |
#ifndef PTRARRAY_H
|
|
Packit |
da78c2 |
#define PTRARRAY_H
|
|
Packit |
da78c2 |
#include <stdlib.h>
|
|
Packit |
da78c2 |
|
|
Packit |
da78c2 |
typedef struct ptrarray_t {
|
|
Packit |
da78c2 |
void **pdata;
|
|
Packit |
da78c2 |
size_t len;
|
|
Packit |
da78c2 |
size_t capacity;
|
|
Packit |
da78c2 |
size_t capacity_step;
|
|
Packit |
da78c2 |
} ptrarray_t;
|
|
Packit |
da78c2 |
|
|
Packit |
da78c2 |
ptrarray_t *ptr_array_new(int capacity);
|
|
Packit |
da78c2 |
void ptr_array_free(ptrarray_t *pa);
|
|
Packit |
da78c2 |
void ptr_array_add(ptrarray_t *pa, void *data);
|
|
Packit |
da78c2 |
void* ptr_array_index(ptrarray_t *pa, size_t index);
|
|
Packit |
da78c2 |
#endif
|