From f4a6bacdb4ec6a7ba64635b1d568a60aa1648426 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 8 Jun 2006 10:33:19 +0000 Subject: [PATCH] Function data1_path_fopen doesn not call yaz_fopen if profilePath is NULL or "". --- data1/d1_absyn.c | 10 ++++------ data1/d1_espec.c | 5 +---- data1/d1_handle.c | 20 ++++++++++++++++---- data1/d1_map.c | 5 +---- data1/d1_marc.c | 5 +---- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/data1/d1_absyn.c b/data1/d1_absyn.c index a1bc53d..2879df4 100644 --- a/data1/d1_absyn.c +++ b/data1/d1_absyn.c @@ -1,4 +1,4 @@ -/* $Id: d1_absyn.c,v 1.25 2006-05-19 13:49:33 adam Exp $ +/* $Id: d1_absyn.c,v 1.26 2006-06-08 10:33:19 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -166,7 +166,7 @@ data1_absyn *data1_absyn_search (data1_handle dh, const char *name) return p->absyn; p = p->next; } - return NULL; + return 0; } /* *ostrich* We need to destroy DFAs, in xp_element (xelm) definitions @@ -241,7 +241,7 @@ data1_attset *data1_attset_search_name (data1_handle dh, const char *name) return p->attset; p = p->next; } - return NULL; + return 0; } data1_attset *data1_attset_search_id (data1_handle dh, int id) @@ -254,7 +254,7 @@ data1_attset *data1_attset_search_id (data1_handle dh, int id) return p->attset; p = p->next; } - return NULL; + return 0; } data1_attset *data1_attset_add (data1_handle dh, const char *name) @@ -715,7 +715,6 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file); if (file_must_exist) return 0; } @@ -1208,7 +1207,6 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, fix_element_ref (dh, res, cur_elements->elements); } *systagsp = 0; - yaz_log(YLOG_DEBUG, "%s: data1_read_absyn end", file); return res; } /* diff --git a/data1/d1_espec.c b/data1/d1_espec.c index d170d8a..dbd5277 100644 --- a/data1/d1_espec.c +++ b/data1/d1_espec.c @@ -1,4 +1,4 @@ -/* $Id: d1_espec.c,v 1.10 2006-05-10 08:13:18 adam Exp $ +/* $Id: d1_espec.c,v 1.11 2006-06-08 10:33:19 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -225,10 +225,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) Z_Espec1 *res = (Z_Espec1 *)nmem_malloc(nmem, sizeof(*res)); if (!(f = data1_path_fopen(dh, file, "r"))) - { - yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; - } res->num_elementSetNames = 0; res->elementSetNames = 0; diff --git a/data1/d1_handle.c b/data1/d1_handle.c index f6ea2d7..332cbf3 100644 --- a/data1/d1_handle.c +++ b/data1/d1_handle.c @@ -1,4 +1,4 @@ -/* $Id: d1_handle.c,v 1.11 2006-05-10 08:13:18 adam Exp $ +/* $Id: d1_handle.c,v 1.12 2006-06-08 10:33:19 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -49,7 +49,7 @@ data1_handle data1_create(void) { data1_handle p = (data1_handle)xmalloc (sizeof(*p)); if (!p) - return NULL; + return 0; p->tab_path = NULL; p->tab_root = NULL; p->wrbuf = wrbuf_alloc(); @@ -150,10 +150,22 @@ const char *data1_get_tabroot (data1_handle dp) FILE *data1_path_fopen (data1_handle dh, const char *file, const char *mode) { + FILE *f; const char *path = data1_get_tabpath(dh); const char *root = data1_get_tabroot(dh); - yaz_log(YLOG_DEBUG, "data1_fath_fopen file=%s mode=%s", file, mode); - return yaz_fopen (path, file, "r", root); + if (!path || !*path) + { + yaz_log(YLOG_DEBUG, "data1_fath_fopen file=%s mode=%s no open", + file, mode); + return 0; + } + yaz_log(YLOG_DEBUG, "data1_fath_fopen path=%s root=%s " + "file=%s mode=%s", path ? path : "NULL", + root ? root : "NULL", file, mode); + f = yaz_fopen(path, file, "r", root); + if (!f) + yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file); + return f; } int data1_is_xmlmode(data1_handle dh) diff --git a/data1/d1_map.c b/data1/d1_map.c index 4039dc5..5bbe680 100644 --- a/data1/d1_map.c +++ b/data1/d1_map.c @@ -1,4 +1,4 @@ -/* $Id: d1_map.c,v 1.9 2006-05-10 08:13:18 adam Exp $ +/* $Id: d1_map.c,v 1.10 2006-06-08 10:33:19 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -42,10 +42,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) int local_numeric = 0; if (!(f = data1_path_fopen(dh, file, "r"))) - { - yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; - } res->name = 0; res->target_absyn_ref = VAL_NONE; diff --git a/data1/d1_marc.c b/data1/d1_marc.c index 7299506..3ef8172 100644 --- a/data1/d1_marc.c +++ b/data1/d1_marc.c @@ -1,4 +1,4 @@ -/* $Id: d1_marc.c,v 1.14 2006-05-10 08:13:18 adam Exp $ +/* $Id: d1_marc.c,v 1.15 2006-06-08 10:33:19 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -44,10 +44,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) int argc; if (!(f = data1_path_fopen(dh, file, "r"))) - { - yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; - } res->name = 0; res->reference = VAL_NONE; -- 1.7.10.4