project_files/frontlib/util/list.h
author Medo <smaxein@googlemail.com>
Thu, 21 Jun 2012 21:32:12 +0200
changeset 7269 5b0aeef8ba2a
child 7275 15f722e0b96f
permissions -rw-r--r--
More progress on the netplay part of the frontlib

/**
 * Simple dynamic array manipulation functions.
 */

#ifndef LIST_H_
#define LIST_H_

#include <stddef.h>

/**
 * Insert element into the list and increase listSize.
 * Returns a pointer to the modified list on success, NULL on failure. On success, the old
 * pointer is no longer valid, and on failure the list remains unchanged (similar to realloc)
 */
void *flib_list_insert(void *list, int *listSizePtr, size_t elementSize, void *elementPtr, int pos);

/**
 * Remove an element from the list and decrease listSize.
 * Returns a pointer to the modified list on success, NULL on failure. On success, the old
 * pointer is no longer valid, and on failure the list remains unchanged (similar to realloc)
 */
void *flib_list_delete(void *list, int *listSizePtr, size_t elementSize, int pos);

#endif /* LIST_H_ */