Use BBLOCK.
[dragonfly.git] / contrib / cvs-1.12 / src / hash.h
bloba595a22e0aa5058d9d8f4b0efbd808c4f71dd978
1 /*
2 * Copyright (C) 1986-2005 The Free Software Foundation, Inc.
4 * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
5 * and others.
7 * Portions Copyright (C) 1992, Brian Berliner and Jeff Polk
8 *
9 * You may distribute under the terms of the GNU General Public License as
10 * specified in the README file that comes with the CVS source distribution.
14 * The number of buckets for the hash table contained in each list. This
15 * should probably be prime.
17 #define HASHSIZE 151
20 * Types of nodes
22 enum ntype
24 NT_UNKNOWN, HEADER, ENTRIES, FILES, LIST, RCSNODE,
25 RCSVERS, DIRS, UPDATE, LOCK, NDBMNODE, FILEATTR,
26 VARIABLE, RCSFIELD, RCSCMPFLD
28 typedef enum ntype Ntype;
30 struct node
32 Ntype type;
33 struct node *next;
34 struct node *prev;
35 struct node *hashnext;
36 struct node *hashprev;
37 char *key;
38 void *data;
39 void (*delproc) (struct node *);
41 typedef struct node Node;
43 struct list
45 Node *list;
46 Node *hasharray[HASHSIZE];
47 struct list *next;
49 typedef struct list List;
51 List *getlist (void);
52 Node *findnode (List *list, const char *key);
53 Node *findnode_fn (List *list, const char *key);
54 Node *getnode (void);
55 int insert_before (List *list, Node *marker, Node *p);
56 int addnode (List *list, Node *p);
57 int addnode_at_front (List *list, Node *p);
58 int walklist (List *list, int (*)(Node *n, void *closure), void *closure);
59 int list_isempty (List *list);
60 void removenode (Node *p);
61 void mergelists (List *dest, List **src);
62 void dellist (List **listp);
63 void delnode (Node *p);
64 void freenode (Node *p);
65 void sortlist (List *list, int (*)(const Node *, const Node *));
66 int fsortcmp (const Node *p, const Node *q);