Lines Matching refs:l

62 item_add(itemlist l, char *s)  in item_add()  argument
64 if (l->nallocated < 0) { in item_add()
66 l->nallocated = l->nused + ALLOCCHUNK; in item_add()
67 new = malloc(sizeof (char *) * l->nused); in item_add()
68 memcpy(new, l->items, l->nused * sizeof (char *)); in item_add()
69 l->items = new; in item_add()
70 } else if (l->nallocated == l->nused) { in item_add()
71 if (l->nallocated) in item_add()
72 l->nallocated *= 2; in item_add()
74 l->nallocated = ALLOCCHUNK; in item_add()
75 l->items = realloc(l->items, sizeof (char *) * l->nallocated); in item_add()
77 l->items[l->nused++] = s; in item_add()
78 l->sorted = l->nused <= 1; in item_add()
82 item_add_list(itemlist l, char **s, int n, int alloc) in item_add_list() argument
84 if (l->nallocated == 0) { in item_add_list()
85 l->items = s; in item_add_list()
86 l->nallocated = alloc ? n : -1; in item_add_list()
87 l->nused = n; in item_add_list()
88 l->sorted = 0; in item_add_list()
93 item_add(l, s[i]); in item_add_list()
101 item_addfile(itemlist l, const char *fname) in item_addfile() argument
114 item_add(l, strdup(buf)); in item_addfile()
128 item_search(itemlist l, const char *s) in item_search() argument
131 int hi = l->nused - 1; in item_search()
133 if (!l->sorted) { in item_search()
134 qsort(l->items, l->nused, sizeof (char *), xcmp); in item_search()
135 l->sorted = 1; in item_search()
140 int res = strcmp(s, l->items[mid]); in item_search()
153 *item_get(itemlist l, int i) in item_get() argument
155 if (i >= l->nused || i < 0) in item_get()
158 return (l->items[i]); in item_get()