Various minor fixes for compiler/linter (other then splint itself) warnings.
[splint-patched.git] / src / Headers / cstringTable.h
blob638e1be8a602ff93b741f9db0890530e408a3dab
1 /*
2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003.
3 ** See ../LICENSE for license information.
4 **
5 */
6 /*
7 ** cstringTable.h
8 */
10 # ifndef CSTRINGTABLE_H
11 # define CSTRINGTABLE_H
13 /*@constant int HBUCKET_BASESIZE; @*/
14 # define HBUCKET_BASESIZE 2
16 /*@constant int HBUCKET_DNE; @*/
17 # define HBUCKET_DNE NOT_FOUND
19 /* in forwardTypes:
20 abst_typedef null struct _cstringTable *cstringTable;
23 /*:private:*/ typedef struct
25 /*@only@*/ cstring key;
26 int val;
27 } *hentry;
29 /*:private:*/ typedef /*@only@*/ hentry o_hentry;
31 typedef /*@null@*/ struct
33 int size;
34 int nspace;
35 /*@only@*/ o_hentry *entries;
36 } *hbucket;
38 typedef /*@only@*/ hbucket o_hbucket;
40 struct s_cstringTable
42 unsigned long size;
43 unsigned long nentries;
44 /*@only@*/ o_hbucket *buckets;
45 } ;
48 /*@constant null cstringTable cstringTable_undefined; @*/
49 # define cstringTable_undefined ((cstringTable) NULL)
51 extern /*@falsewhennull@*/ bool cstringTable_isDefined(cstringTable) /*@*/ ;
52 # define cstringTable_isDefined(p_h) ((p_h) != cstringTable_undefined)
54 extern /*@nullwhentrue@*/ /*@unused@*/ bool cstringTable_isUndefined(cstringTable) /*@*/ ;
55 # define cstringTable_isUndefined(p_h) ((p_h) == cstringTable_undefined)
57 extern /*@only@*/ cstringTable cstringTable_create(unsigned long p_size) /*@*/ ;
58 extern void cstringTable_insert (cstringTable p_h,
59 /*@only@*/ cstring p_key,
60 int p_value) /*@modifies p_h@*/ ;
62 extern int cstringTable_lookup (cstringTable p_h, cstring p_key);
63 extern void cstringTable_free (/*@only@*/ cstringTable p_h);
64 extern void cstringTable_remove (cstringTable p_h, cstring p_key) /*@modifies p_h@*/ ;
66 extern void
67 cstringTable_replaceKey (cstringTable p_h, cstring p_oldkey,
68 /*@only@*/ cstring p_newkey);
70 # else
71 # error "Multiple include"
72 # endif