Lines Matching defs:store
34 struct store {
37 char **store;
42 struct store *storecreate(struct store *);
43 static int storeappend(struct store *, const char *);
63 static struct store *store = NULL;
68 store = storecreate(store);
69 if (store == NULL) {
122 errcode = storeappend(store, matched);
137 storeappend(store, patterns[i]);
140 if (store->used == 0)
143 return store->store;
303 struct store *store = NULL;
304 store = storecreate(store);
309 storeappend(store, installed[j]);
313 if (store->used == 0)
316 matches[i] = store->store;
544 * Create an empty store, optionally deallocating
545 * any previously allocated space if store != NULL.
547 struct store *
548 storecreate(struct store *store)
552 if (store == NULL) {
553 store = malloc(sizeof *store);
554 if (store == NULL) {
558 store->currlen = 0;
559 store->store = NULL;
560 } else if (store->store != NULL) {
562 for (i = 0; store->store[i] != NULL; i++)
563 free(store->store[i]);
564 store->store[0] = NULL;
566 store->used = 0;
568 return store;
572 * Append specified element to the provided store.
575 storeappend(struct store *store, const char *item)
577 if (store->used + 2 > store->currlen) {
578 store->currlen += 16;
579 store->store = reallocf(store->store,
580 store->currlen * sizeof(*(store->store)));
581 if (store->store == NULL) {
582 store->currlen = 0;
588 asprintf(&(store->store[store->used]), "%s", item);
589 if (store->store[store->used] == NULL) {
593 store->used++;
594 store->store[store->used] = NULL;