eea8b1a050b8fbf8147c192c2d2804584084d1c0
[idzebra-moved-to-github.git] / dict / close.c
1 /*
2  * Copyright (C) 1994-1999, Index Data
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: close.c,v $
7  * Revision 1.6  1999-02-02 14:50:15  adam
8  * Updated WIN32 code specific sections. Changed header.
9  *
10  * Revision 1.5  1994/09/01 17:49:36  adam
11  * Removed stupid line. Work on insertion in dictionary. Not finished yet.
12  *
13  * Revision 1.4  1994/09/01  17:44:06  adam
14  * depend include change.
15  *
16  * Revision 1.3  1994/08/18  12:40:52  adam
17  * Some development of dictionary. Not finished at all!
18  *
19  * Revision 1.2  1994/08/17  13:32:19  adam
20  * Use cache in dict - not in bfile.
21  *
22  * Revision 1.1  1994/08/16  16:26:47  adam
23  * Added dict.
24  *
25  */
26
27 #include <stdlib.h>
28 #include <string.h>
29 #include <stdio.h>
30 #include <assert.h>
31
32 #include <dict.h>
33
34 int dict_close (Dict dict)
35 {
36     assert (dict);
37
38     if (dict->rw)
39     {
40         void *head_buf;
41         dict_bf_readp (dict->dbf, 0, &head_buf);
42         memcpy (head_buf, &dict->head, sizeof(dict->head));
43         dict_bf_touch (dict->dbf, 0);        
44     }
45     dict_bf_close (dict->dbf);
46     xfree (dict);
47     return 0;
48 }
49