Lines Matching refs:sym

90 		sym_error = "sym header malloc failed!";
95 h->sym = NULL;
100 static struct sym *mknode(struct sym *next, char *key, void *data)
102 struct sym *n;
104 if ((n = malloc(sizeof(struct sym))) == NULL) {
105 sym_error = "sym node malloc failed!";
114 sym_error = "sym node strdup(key) failed!";
124 static struct sym *find_key1(struct sym *sym, char *key)
126 while (sym != NULL)
127 if (strcmp(sym->key, key) == 0)
128 return (sym);
130 sym = sym->next;
137 static int add_key(SYM sym, char *key, void *data)
139 register struct sym *sn;
141 if (sym->sym == NULL) {
142 sym->sym = mknode(NULL, key, data);
143 if (sym->sym == NULL) {
147 for (sn = sym->sym; sn != NULL && sn->next != NULL;
194 int sym_put(SYM sym, char *key, void *data, int flags)
200 struct sym *nsym = NULL; /* search: found symbol entry */
202 if (sym == NULL)
213 for (kk = (char **)keys, csym = sym;
214 *kk != NULL && (nsym = find_key1(csym->sym, *kk)) != NULL;
265 void *sym_get(SYM sym, char *key)
271 struct sym *nsym = NULL; /* search: found symbol entry */
273 if (sym == NULL)
281 for (kk = (char **)keys, csym = sym;
282 *kk != NULL && (nsym = find_key1(csym->sym, *kk)) != NULL;
317 int sym_seq(SYM sym, DBT * key, DBT * data, int flags)
334 csym = (SYM) sym_get(sym, (char *)key->data);
338 sym->cursor = csym->sym;
339 if (sym->cursor == NULL)
341 key->data = sym->cursor->key;
342 data->data = sym->cursor->data;
347 sym->cursor = sym->sym;
348 if (sym->cursor == NULL)
350 key->data = sym->cursor->key;
351 data->data = sym->cursor->data;
356 if (sym->cursor == NULL)
358 sym->cursor = sym->cursor->next;
360 if (sym->cursor == NULL)
363 key->data = sym->cursor->key;
364 data->data = sym->cursor->data;
380 int sym_dump(SYM sym, int depth)
383 register struct sym *se; /* symbol entry */
386 if (sym == NULL || sym->magic != SYM_MAGIC)
389 for (se = sym->sym; se != NULL; se = se->next) {
401 * sym dump, but data is _always_ a string (print it)
403 int sym_dump_s(SYM sym, int depth)
406 register struct sym *se; /* symbol entry */
409 if (sym == NULL)
412 if (sym->magic != SYM_MAGIC) {
417 printf(" = %s\n", (char *)sym);
421 for (se = sym->sym; se != NULL; se = se->next) {
441 int sym_rm(SYM sym, int flags)
443 register struct sym *se, *nse; /* symbol entry */
445 if (sym == NULL)
448 if (sym->magic != SYM_MAGIC) {
450 free(sym);
454 for (se = sym->sym; se != NULL;) {
465 free(sym);