5 Jan
2005
5 Jan
'05
5:18 p.m.
On Wed, Jan 05, 2005 at 01:58:45PM +0100, Peter Berg Larsen wrote:
+void strarray_set(strarray* arr, int index, const char* str) +{ + if (index >= arr->maximum) + { + arr->maximum = index+10; + arr->base = xrealloc(arr->base, sizeof(*(arr->base)) * arr->maximum); + memset(&(arr->base[arr->size]),0,sizeof(*(arr->base)) * (arr->maximum - arr->size)); + } + arr->base[index] = str; + if (arr->size <= index) + arr->size = index+1; +}
Do we really need this strarray_set() function? Even if you do, it should _not_ shorten the array. -- Dimi.