+ list->numstrings = 0;
+ list->maxstrings = 0;
+ if (list->strings)
+ Z_Free(list->strings);
+ list->strings = NULL;
+}
+
+void stringlistappend(stringlist_t *list, const char *text)
+{
+ size_t textlen;
+ char **oldstrings;
+
+ if (list->numstrings >= list->maxstrings)
+ {
+ oldstrings = list->strings;
+ list->maxstrings += 4096;
+ list->strings = (char **) Z_Malloc(list->maxstrings * sizeof(*list->strings));
+ if (list->numstrings)
+ memcpy(list->strings, oldstrings, list->numstrings * sizeof(*list->strings));
+ if (oldstrings)
+ Z_Free(oldstrings);
+ }
+ textlen = strlen(text) + 1;
+ list->strings[list->numstrings] = (char *) Z_Malloc(textlen);
+ memcpy(list->strings[list->numstrings], text, textlen);
+ list->numstrings++;
+}
+
+static int stringlistsort_cmp(const void *a, const void *b)
+{
+ return strcasecmp(*(const char **)a, *(const char **)b);