Lines Matching defs:sl
49 StringList *sl;
51 sl = malloc(sizeof(StringList));
52 if (sl == NULL)
55 sl->sl_cur = 0;
56 sl->sl_max = _SL_CHUNKSIZE;
57 sl->sl_str = malloc(sl->sl_max * sizeof(char *));
58 if (sl->sl_str == NULL)
60 return sl;
68 sl_add(StringList *sl, char *name)
70 if (sl->sl_cur == sl->sl_max - 1) {
71 sl->sl_max += _SL_CHUNKSIZE;
72 sl->sl_str = reallocf(sl->sl_str, sl->sl_max * sizeof(char *));
73 if (sl->sl_str == NULL)
76 sl->sl_str[sl->sl_cur++] = name;
85 sl_free(StringList *sl, int all)
89 if (sl == NULL)
91 if (sl->sl_str) {
93 for (i = 0; i < sl->sl_cur; i++)
94 free(sl->sl_str[i]);
95 free(sl->sl_str);
97 free(sl);
105 sl_find(StringList *sl, const char *name)
109 for (i = 0; i < sl->sl_cur; i++)
110 if (strcmp(sl->sl_str[i], name) == 0)
111 return sl->sl_str[i];