X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=data1%2Fd1_handle.c;h=861f76f81cbbc81c9b53fc386ac33924c17fc988;hp=723a08100fc8e1651e37c7ffa25fb25c1bc7d876;hb=e2e073b5c947e996304ed7d577497af5e9a879ee;hpb=6c9fcd3b5d3108702fa1ffc92dab4ab6060f9a19 diff --git a/data1/d1_handle.c b/data1/d1_handle.c index 723a081..861f76f 100644 --- a/data1/d1_handle.c +++ b/data1/d1_handle.c @@ -1,8 +1,5 @@ -/* $Id: d1_handle.c,v 1.7 2005-01-15 19:38:18 adam Exp $ - Copyright (C) 1995-2005 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -15,17 +12,22 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include +#define DATA1_FLAG_XML 1 + struct data1_handle_info { WRBUF wrbuf; char *tab_path; @@ -41,19 +43,13 @@ struct data1_handle_info { int map_len; NMEM mem; - int flags; }; -data1_handle data1_create (void) -{ - return data1_createx(0); -} - -data1_handle data1_createx (int flags) +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(); @@ -64,7 +60,6 @@ data1_handle data1_createx (int flags) p->absyn_cache = NULL; p->attset_cache = NULL; p->mem = nmem_create (); - p->flags = flags; return p; } @@ -87,14 +82,14 @@ void data1_destroy (data1_handle dh) { if (!dh) return; - + /* *ostrich* - We need to destroy DFAs, in xp_element (xelm) definitions + We need to destroy DFAs, in xp_element (xelm) definitions pop, 2002-12-13 */ data1_absyn_destroy(dh); - wrbuf_free (dh->wrbuf, 1); + wrbuf_destroy(dh->wrbuf); if (dh->tab_path) xfree (dh->tab_path); if (dh->tab_root) @@ -104,7 +99,7 @@ void data1_destroy (data1_handle dh) if (dh->map_buf) xfree (dh->map_buf); nmem_destroy (dh->mem); - + xfree (dh); } @@ -155,12 +150,37 @@ 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); - return yaz_fopen (path, file, "r", root); + + yaz_log(YLOG_DEBUG, "data1_path_fopen path=%s root=%s " + "file=%s mode=%s", path ? path : "NULL", + root ? root : "NULL", file, mode); + if (!path || !*path) + return 0; + f = yaz_fopen(path, file, mode, root); + if (!f) + { + yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file); + if (root) + yaz_log(YLOG_LOG, "for root=%s", root); + if (path) + yaz_log(YLOG_LOG, "for profilePath=%s", path); + } + return f; } int data1_is_xmlmode(data1_handle dh) { - return dh->flags & DATA1_FLAG_XML; + return 1; } +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +