f4e30c0ec44a8a83358ae145a52de6c071009174
[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.5  1994-09-01 17:49:36  adam
8  * Removed stupid line. Work on insertion in dictionary. Not finished yet.
9  *
10  * Revision 1.4  1994/09/01  17:44:06  adam
11  * depend include change.
12  *
13  * Revision 1.3  1994/08/18  12:40:52  adam
14  * Some development of dictionary. Not finished at all!
15  *
16  * Revision 1.2  1994/08/17  13:32:19  adam
17  * Use cache in dict - not in bfile.
18  *
19  * Revision 1.1  1994/08/16  16:26:47  adam
20  * Added dict.
21  *
22  */
23
24 #include <stdlib.h>
25 #include <string.h>
26 #include <stdio.h>
27 #include <assert.h>
28
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