Home | History | Annotate | Download | only in gen

Lines Matching defs:sl

63 	StringList *sl;
65 sl = malloc(sizeof(StringList));
66 if (sl == NULL)
69 sl->sl_cur = 0;
70 sl->sl_max = _SL_CHUNKSIZE;
71 sl->sl_str = NULL;
72 errno = reallocarr(&sl->sl_str, sl->sl_max, sizeof(*sl->sl_str));
75 free(sl);
77 sl = NULL;
79 return sl;
87 sl_add(StringList *sl, char *name)
90 _DIAGASSERT(sl != NULL);
92 if (sl->sl_cur == sl->sl_max - 1) {
93 char **new = sl->sl_str;
95 errno = reallocarr(&new, (sl->sl_max + _SL_CHUNKSIZE),
99 sl->sl_max += _SL_CHUNKSIZE;
100 sl->sl_str = new;
102 sl->sl_str[sl->sl_cur++] = name;
111 sl_free(StringList *sl, int all)
115 if (sl == NULL)
117 if (sl->sl_str) {
119 for (i = 0; i < sl->sl_cur; i++)
120 free(sl->sl_str[i]);
121 free(sl->sl_str);
123 free(sl);
131 sl_find(StringList *sl, const char *name)
135 _DIAGASSERT(sl != NULL);
137 for (i = 0; i < sl->sl_cur; i++)
138 if (strcmp(sl->sl_str[i], name) == 0)
139 return sl->sl_str[i];
145 sl_delete(StringList *sl, const char *name, int all)
149 for (i = 0; i < sl->sl_cur; i++)
150 if (strcmp(sl->sl_str[i], name) == 0) {
152 free(sl->sl_str[i]);
153 for (j = i + 1; j < sl->sl_cur; j++)
154 sl->sl_str[j - 1] = sl->sl_str[j];
155 sl->sl_str[--sl->sl_cur] = NULL;