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