]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/src/hash.h
This commit was generated by cvs2svn to compensate for changes in r171366,
[FreeBSD/FreeBSD.git] / contrib / cvs / src / hash.h
1 /*
2  * Copyright (c) 1992, Brian Berliner and Jeff Polk
3  * 
4  * You may distribute under the terms of the GNU General Public License as
5  * specified in the README file that comes with the CVS source distribution.
6  */
7
8 /*
9  * The number of buckets for the hash table contained in each list.  This
10  * should probably be prime.
11  */
12 #define HASHSIZE        151
13
14 /*
15  * Types of nodes
16  */
17 enum ntype
18 {
19     NT_UNKNOWN, HEADER, ENTRIES, FILES, LIST, RCSNODE,
20     RCSVERS, DIRS, UPDATE, LOCK, NDBMNODE, FILEATTR,
21     VARIABLE, RCSFIELD, RCSCMPFLD
22 };
23 typedef enum ntype Ntype;
24
25 struct node
26 {
27     Ntype type;
28     struct node *next;
29     struct node *prev;
30     struct node *hashnext;
31     struct node *hashprev;
32     char *key;
33     void *data;
34     void (*delproc) ();
35 };
36 typedef struct node Node;
37
38 struct list
39 {
40     Node *list;
41     Node *hasharray[HASHSIZE];
42     struct list *next;
43 };
44 typedef struct list List;
45
46 List *getlist PROTO((void));
47 Node *findnode PROTO((List * list, const char *key));
48 Node *findnode_fn PROTO((List * list, const char *key));
49 Node *getnode PROTO((void));
50 int insert_before PROTO((List * list, Node * marker, Node * p));
51 int addnode PROTO((List * list, Node * p));
52 int addnode_at_front PROTO((List * list, Node * p));
53 int walklist PROTO((List * list, int (*)(Node *n, void *closure), void *closure));
54 int list_isempty PROTO ((List *list));
55 void dellist PROTO((List ** listp));
56 void delnode PROTO((Node * p));
57 void freenode PROTO((Node * p));
58 void sortlist PROTO((List * list, int (*)(const Node *, const Node *)));
59 int fsortcmp PROTO((const Node * p, const Node * q));