From d64c82cd05145e97c4edef0434c383a29c95c8fe Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 16 May 2007 08:57:26 +0000 Subject: [PATCH] Indentation. Removed a few unused functions. --- include/idzebra/res.h | 25 ++---------- util/res.c | 101 ++++++------------------------------------------- 2 files changed, 16 insertions(+), 110 deletions(-) diff --git a/include/idzebra/res.h b/include/idzebra/res.h index bfc29fa..c112d89 100644 --- a/include/idzebra/res.h +++ b/include/idzebra/res.h @@ -1,4 +1,4 @@ -/* $Id: res.h,v 1.12 2007-01-15 20:08:24 adam Exp $ +/* $Id: res.h,v 1.13 2007-05-16 08:57:26 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -58,7 +58,7 @@ void res_set(Res r, const char *name, const char *value); YAZ_EXPORT int res_trav(Res r, const char *prefix, void *p, - void (*f)(void *p, const char *name, const char *value)); + void (*f)(void *p, const char *name, const char *value)); YAZ_EXPORT const char *res_get_prefix(Res r, const char *name, const char *prefix, @@ -68,28 +68,11 @@ YAZ_EXPORT ZEBRA_RES res_get_int(Res r, const char *name, int *val); -/* == pop ================================================================= */ - -YAZ_EXPORT -Res res_add_over (Res p, Res t); - -YAZ_EXPORT -void res_remove_over (Res r); - -YAZ_EXPORT -void res_close_over (Res r); - -YAZ_EXPORT -void res_add (Res r, const char *name, const char *value); - -YAZ_EXPORT -char **res_2_array (Res r); - YAZ_EXPORT -char **res_get_array(Res r, const char* name); +void res_add(Res r, const char *name, const char *value); YAZ_EXPORT -void res_dump (Res r, int level); +void res_dump(Res r, int level); YAZ_EXPORT int res_check(Res r_i, Res r_v); diff --git a/util/res.c b/util/res.c index fda7330..5df5efd 100644 --- a/util/res.c +++ b/util/res.c @@ -1,4 +1,4 @@ -/* $Id: res.c,v 1.56 2007-01-15 15:10:26 adam Exp $ +/* $Id: res.c,v 1.57 2007-05-16 08:57:27 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -359,7 +359,7 @@ void res_set(Res r, const char *name, const char *value) } int res_trav(Res r, const char *prefix, void *p, - void (*f)(void *p, const char *name, const char *value)) + void (*f)(void *p, const char *name, const char *value)) { struct res_entry *re; int l = 0; @@ -445,97 +445,20 @@ ZEBRA_RES res_get_int(Res r, const char *name, int *val) return ZEBRA_FAIL; } -/* == pop ================================================================= */ -Res res_add_over (Res p, Res t) -{ - if ((!p) || (!t)) - return (0); - - while (p->over_res) - p = p->over_res; - - p->over_res = t; - return (p); -} - -void res_remove_over (Res r) -{ - if (!r) - return; - r->over_res = 0; -} -void res_close_over (Res r) -{ - if (!r) - return; - if (r->over_res) - res_close(r->over_res); - r->over_res = 0; -} - -void res_add (Res r, const char *name, const char *value) +void res_add(Res r, const char *name, const char *value) { struct res_entry *re; assert(r); assert(name); assert(value); - yaz_log (YLOG_RES, "res_add res=%p, name=%s, value=%s", r, name, value); - re = add_entry (r); - re->name = xstrdup (name); - re->value = xstrdup_env (value); -} - -char **res_2_array (Res r) -{ - struct res_entry *re; - int i = 0; - char **list; - - if (!r) - return 0; - - list = xmalloc(sizeof(char *)); - - for (re = r->first; re; re=re->next) { - list = xrealloc(list, ((i+3) * sizeof(char *))); - list[i++] = strdup(re->name); - if (re->value) - list[i++] = strdup(re->value); - else - list[i++] = strdup(""); - yaz_log(YLOG_RES, "res2array: %s=%s",re->name, re->value); - } - list[i++] = 0; - return (list); -} - -char **res_get_array(Res r, const char* name) -{ - struct res_entry *re; - int i = 0; - char **list; - - if (!r) - return 0; - - list = xmalloc(sizeof(char *)); - - for (re = r->first; re; re=re->next) - if (re->value && !yaz_matchstr (re->name, name)) - { - list = xrealloc(list, (i+2) * sizeof(char *)); - list[i++] = xstrdup(re->value); - } - - if (i == 0) - return (res_get_array(r->def_res, name)); - - list[i++] = 0; - return (list); + yaz_log(YLOG_RES, "res_add res=%p, name=%s, value=%s", r, name, value); + re = add_entry(r); + re->name = xstrdup(name); + re->value = xstrdup_env(value); } -void res_dump (Res r, int level) +void res_dump(Res r, int level) { struct res_entry *re; @@ -547,13 +470,13 @@ void res_dump (Res r, int level) } if (r->def_res) { - printf ("%*s DEF ",level * 4,""); - res_dump (r->def_res, level + 1); + printf("%*s DEF ",level * 4,""); + res_dump(r->def_res, level + 1); } if (r->over_res) { - printf ("%*s OVER ",level * 4,""); - res_dump (r->over_res, level + 1); + printf("%*s OVER ",level * 4,""); + res_dump(r->over_res, level + 1); } } -- 1.7.10.4