Lines Matching defs:sl
45 stringlist *sl;
47 if ((sl = malloc(sizeof (stringlist))) == NULL)
50 sl->sl_cur = 0;
51 sl->sl_max = _SL_CHUNKSIZE;
52 sl->sl_str = malloc(sl->sl_max * sizeof (char *));
53 if (sl->sl_str == NULL)
56 return (sl);
60 sl_add(stringlist *sl, char *name)
63 if (sl->sl_cur == sl->sl_max - 1) {
64 sl->sl_max += _SL_CHUNKSIZE;
65 sl->sl_str = realloc(sl->sl_str, sl->sl_max * sizeof (char *));
66 if (sl->sl_str == NULL)
69 sl->sl_str[sl->sl_cur++] = name;
76 sl_free(stringlist *sl, int all)
80 if (sl == NULL)
82 if (sl->sl_str) {
84 for (i = 0; i < sl->sl_cur; i++)
85 free(sl->sl_str[i]);
86 free(sl->sl_str);
88 free(sl);
93 sl_find(stringlist *sl, char *name)
97 for (i = 0; i < sl->sl_cur; i++)
98 if (strcmp(sl->sl_str[i], name) == 0)
99 return (sl->sl_str[i]);