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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     2
 * Simple dynamic array manipulation functions.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     5
#ifndef LIST_H_
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
#define LIST_H_
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
#include <stddef.h>
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    10
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
 * Insert element into the list and increase listSize.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
 * Returns a pointer to the modified list on success, NULL on failure. On success, the old
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
 * pointer is no longer valid, and on failure the list remains unchanged (similar to realloc)
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
void *flib_list_insert(void *list, int *listSizePtr, size_t elementSize, void *elementPtr, int pos);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
 * Remove an element from the list and decrease listSize.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    19
 * Returns a pointer to the modified list on success, NULL on failure. On success, the old
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
 * pointer is no longer valid, and on failure the list remains unchanged (similar to realloc)
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
void *flib_list_delete(void *list, int *listSizePtr, size_t elementSize, int pos);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
#endif /* LIST_H_ */