version 1.1, 1997/02/03 01:05:44 |
version 1.2, 1997/07/25 21:56:23 |
|
|
{ |
{ |
StringList *sl = malloc(sizeof(StringList)); |
StringList *sl = malloc(sizeof(StringList)); |
if (sl == NULL) |
if (sl == NULL) |
_err(1, "stringlist: %m"); |
err(1, "stringlist: %m"); |
|
|
sl->sl_cur = 0; |
sl->sl_cur = 0; |
sl->sl_max = _SL_CHUNKSIZE; |
sl->sl_max = _SL_CHUNKSIZE; |
sl->sl_str = malloc(sl->sl_max * sizeof(char *)); |
sl->sl_str = malloc(sl->sl_max * sizeof(char *)); |
if (sl->sl_str == NULL) |
if (sl->sl_str == NULL) |
_err(1, "stringlist: %m"); |
err(1, "stringlist: %m"); |
return sl; |
return sl; |
} |
} |
|
|
|
|
sl->sl_max += _SL_CHUNKSIZE; |
sl->sl_max += _SL_CHUNKSIZE; |
sl->sl_str = realloc(sl->sl_str, sl->sl_max * sizeof(char *)); |
sl->sl_str = realloc(sl->sl_str, sl->sl_max * sizeof(char *)); |
if (sl->sl_str == NULL) |
if (sl->sl_str == NULL) |
_err(1, "stringlist: %m"); |
err(1, "stringlist: %m"); |
} |
} |
sl->sl_str[sl->sl_cur++] = name; |
sl->sl_str[sl->sl_cur++] = name; |
} |
} |