Updated code to use new YAZ log functions/defines.
[idzebra-moved-to-github.git] / dict / close.c
1 /* $Id: close.c,v 1.7.2.2 2006-12-05 21:14:40 adam Exp $
2    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
3    Index Data Aps
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 */
22
23 #include <stdlib.h>
24 #include <string.h>
25 #include <stdio.h>
26 #include <assert.h>
27
28 #include <yaz/xmalloc.h>
29 #include <dict.h>
30
31 int dict_close (Dict dict)
32 {
33     assert (dict);
34
35     if (dict->rw)
36     {
37         void *head_buf;
38         dict_bf_readp (dict->dbf, 0, &head_buf);
39         memcpy (head_buf, &dict->head, sizeof(dict->head));
40         dict_bf_touch (dict->dbf, 0);        
41     }
42     dict_bf_close (dict->dbf);
43     xfree (dict);
44     return 0;
45 }
46