X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-opt.c;h=48c0da796e510a3b167efdf3fb1b2382199e18a4;hp=3b727853a4e7c2de36a450700abce4b534c8b30d;hb=d1b8a1c1647ebb00401f6b6e8f992cca7480b5f9;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/src/zoom-opt.c b/src/zoom-opt.c index 3b72785..48c0da7 100644 --- a/src/zoom-opt.c +++ b/src/zoom-opt.c @@ -1,16 +1,36 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** * \file zoom-opt.c * \brief Implements ZOOM options handling */ +#if HAVE_CONFIG_H +#include +#endif + #include #include "zoom-p.h" #include +struct ZOOM_options_entry { + char *name; + char *value; + int len; /* of `value', which may contain NULs */ + struct ZOOM_options_entry *next; +}; + +struct ZOOM_options_p { + int refcount; + void *callback_handle; + ZOOM_options_callback callback_func; + struct ZOOM_options_entry *entries; + ZOOM_options parent1; + ZOOM_options parent2; +}; + static void set_value(struct ZOOM_options_entry **e, const char *value, int len) { @@ -44,7 +64,7 @@ ZOOM_API(ZOOM_options) ZOOM_options dst = ZOOM_options_create(); struct ZOOM_options_entry *src_e = src->entries; struct ZOOM_options_entry **dst_e = &dst->entries; - + while(src_e) { append_entry(dst_e, src_e->name, src_e->value, src_e->len); @@ -102,7 +122,7 @@ ZOOM_API(ZOOM_options_callback) void *callback_handle) { ZOOM_options_callback callback_old; - + assert(opt); callback_old = opt->callback_func; opt->callback_func = callback_func; @@ -119,7 +139,7 @@ ZOOM_API(void) if (opt->refcount == 0) { struct ZOOM_options_entry *e; - + ZOOM_options_destroy(opt->parent1); ZOOM_options_destroy(opt->parent2); e = opt->entries; @@ -203,7 +223,7 @@ ZOOM_API(int) ZOOM_options_get_bool(ZOOM_options opt, const char *name, int defa) { const char *v = ZOOM_options_get(opt, name); - + if (!v) return defa; if (!strcmp(v, "1") || !strcmp(v, "T")) @@ -232,6 +252,7 @@ ZOOM_options_set_int(ZOOM_options opt, const char *name, int value) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab