Lines Matching refs:t
50 table_t *t; in create_stringtable() local
53 if ((t = calloc((size_t)1, (size_t)(sizeof (table_t) + in create_stringtable()
60 t->nelem = size; in create_stringtable()
61 t->used = -1; in create_stringtable()
62 return (t); in create_stringtable()
67 add_to_stringtable(table_t *t, char *value) in add_to_stringtable() argument
73 if (t == NULL) { in add_to_stringtable()
78 if (in_stringtable(t, value)) { in add_to_stringtable()
79 return (t); in add_to_stringtable()
81 ++t->used; in add_to_stringtable()
82 if (t->used >= t->nelem) { in add_to_stringtable()
83 if ((t2 = realloc(t, (size_t)(sizeof (table_t) + in add_to_stringtable()
84 ((sizeof (char *)) * (t->nelem + TABLE_INCREMENT))))) in add_to_stringtable()
86 print_stringtable(t); in add_to_stringtable()
91 t = t2; in add_to_stringtable()
92 t->nelem += TABLE_INCREMENT; in add_to_stringtable()
93 for (i = t->used; i < t->nelem; ++i) { in add_to_stringtable()
94 t->elements[i] = NULL; in add_to_stringtable()
97 t->elements[t->used] = strset(t->elements[t->used], value); in add_to_stringtable()
98 return (t); in add_to_stringtable()
105 free_stringtable(table_t *t) in free_stringtable() argument
108 if (t != NULL) { in free_stringtable()
109 t->used = -1; in free_stringtable()
111 return (t); in free_stringtable()
116 get_stringtable(table_t *t, int index) in get_stringtable() argument
119 if (t == NULL) { in get_stringtable()
121 } else if (index > t->used) { in get_stringtable()
124 return (t->elements[index]); in get_stringtable()
129 in_stringtable(table_t *t, const char *value) in in_stringtable() argument
133 if (t == NULL) { in in_stringtable()
136 for (i = 0; i <= t->used; ++i) { in in_stringtable()
137 if (strcmp(value, t->elements[i]) == 0) in in_stringtable()
145 print_stringtable(table_t *t) in print_stringtable() argument
149 if (t == NULL) in print_stringtable()
154 t->used + 1, t->nelem, in print_stringtable()
155 sizeof (table_t) + (sizeof (char *) * t->nelem)); in print_stringtable()
157 for (i = 0; i <= t->used; ++i) { in print_stringtable()
159 get_stringtable(t, i)); in print_stringtable()
170 sort_stringtable(table_t *t) in sort_stringtable() argument
173 if (t && t->used > 0) { in sort_stringtable()
174 qsort((char *)t->elements, (size_t)t->used, in sort_stringtable()