--- libaitio/src/Attic/sarray.c 2011/05/03 14:48:49 1.1.2.4 +++ libaitio/src/Attic/sarray.c 2011/05/03 15:33:54 1.1.2.5 @@ -156,6 +156,25 @@ io_sarrGet(sarr_t * __restrict arr, u_int idx) } /* + * io_sarrGet2() - Always get element from dynamic split-order array + * Function automatic grow array. Good use for Hash tables! + * @arr = Array + * @idx = Index (warning 1st element is at position 1) + * return: NULL not found, !=NULL element + */ +void * +io_sarrGet2(sarr_t * __restrict arr, u_int idx) +{ + assert(arr); + if (!arr || idx < 1) + return NULL; + if (arr->sarr_num < idx) + if (io_sarrGrow(arr, idx)) + return NULL; + return io_sarrGet(arr, idx); +} + +/* * io_sarrSet() - Set element to dynamic split-order array * @arr = Array * @idx = Index (warning 1st element is at position 1)