Lines Matching full:sl
47 StringList *sl; in sl_init() local
49 sl = malloc(sizeof(StringList)); in sl_init()
50 if (sl == NULL) in sl_init()
53 sl->sl_cur = 0; in sl_init()
54 sl->sl_max = _SL_CHUNKSIZE; in sl_init()
55 sl->sl_str = malloc(sl->sl_max * sizeof(char *)); in sl_init()
56 if (sl->sl_str == NULL) in sl_init()
58 return sl; in sl_init()
66 sl_add(StringList *sl, char *name) in sl_add() argument
68 if (sl->sl_cur == sl->sl_max - 1) { in sl_add()
69 sl->sl_max += _SL_CHUNKSIZE; in sl_add()
70 sl->sl_str = reallocf(sl->sl_str, sl->sl_max * sizeof(char *)); in sl_add()
71 if (sl->sl_str == NULL) in sl_add()
74 sl->sl_str[sl->sl_cur++] = name; in sl_add()
83 sl_free(StringList *sl, int all) in sl_free() argument
87 if (sl == NULL) in sl_free()
89 if (sl->sl_str) { in sl_free()
91 for (i = 0; i < sl->sl_cur; i++) in sl_free()
92 free(sl->sl_str[i]); in sl_free()
93 free(sl->sl_str); in sl_free()
95 free(sl); in sl_free()
103 sl_find(StringList *sl, const char *name) in sl_find() argument
107 for (i = 0; i < sl->sl_cur; i++) in sl_find()
108 if (strcmp(sl->sl_str[i], name) == 0) in sl_find()
109 return sl->sl_str[i]; in sl_find()