Home --> Documentations --> PJLIB Reference
|
void | pj_array_insert (void *array, unsigned elem_size, unsigned count, unsigned pos, const void *value) |
|
void | pj_array_erase (void *array, unsigned elem_size, unsigned count, unsigned pos) |
|
pj_status_t | pj_array_find (const void *array, unsigned elem_size, unsigned count, pj_status_t(*matching)(const void *value), void **result) |
|
This module provides helper to manipulate array of elements of any size. It provides most used array operations such as insert, erase, and search.
◆ pj_array_erase()
void pj_array_erase |
( |
void * |
array, |
|
|
unsigned |
elem_size, |
|
|
unsigned |
count, |
|
|
unsigned |
pos |
|
) |
| |
Erase a value from the array at given position, and rearrange the remaining elements post the erased element.
- Parameters
-
array | the array. |
elem_size | the size of the individual element. |
count | the current number of elements in the array. |
pos | the index/position to delete. |
◆ pj_array_find()
pj_status_t pj_array_find |
( |
const void * |
array, |
|
|
unsigned |
elem_size, |
|
|
unsigned |
count, |
|
|
pj_status_t(*)(const void *value) |
matching, |
|
|
void ** |
result |
|
) |
| |
Search the first value in the array according to matching function.
- Parameters
-
array | the array. |
elem_size | the individual size of the element. |
count | the number of elements. |
matching | the matching function, which MUST return PJ_SUCCESS if the specified element match. |
result | the pointer to the value found. |
- Returns
- PJ_SUCCESS if value is found, otherwise the error code.
◆ pj_array_insert()
void pj_array_insert |
( |
void * |
array, |
|
|
unsigned |
elem_size, |
|
|
unsigned |
count, |
|
|
unsigned |
pos, |
|
|
const void * |
value |
|
) |
| |
Insert value to the array at the given position, and rearrange the remaining nodes after the position.
- Parameters
-
array | the array. |
elem_size | the size of the individual element. |
count | the CURRENT number of elements in the array. |
pos | the position where the new element is put. |
value | the value to copy to the new element. |
PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.
|