ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/shstr.h
(Generate patch)

Comparing deliantra/server/include/shstr.h (file contents):
Revision 1.1 by root, Fri Feb 3 07:12:50 2006 UTC vs.
Revision 1.3 by root, Tue Aug 29 08:01:36 2006 UTC

1#ifndef SHSTR_H__
2#define SHSTR_H__
3
1/* The size of the shared strings hashtable. This must be smaller than 4/* The size of the shared strings hashtable. This must be smaller than
2 * 32767, but 947 ought to be plenty enough. 5 * 32767, but 947 ought to be plenty enough.
3 */ 6 */
4#define TABLESIZE 4133 7#define TABLESIZE 4133
5 8
52 55
53#define PADDING ((2 * sizeof(long) - sizeof(REFCOUNT_TYPE)) % sizeof(long)) + 1 56#define PADDING ((2 * sizeof(long) - sizeof(REFCOUNT_TYPE)) % sizeof(long)) + 1
54 57
55typedef struct _shared_string { 58typedef struct _shared_string {
56 union { 59 union {
57 struct _shared_string **array; 60 struct _shared_string **array;
58 struct _shared_string *previous; 61 struct _shared_string *previous;
59 } u; 62 } u;
60 struct _shared_string *next; 63 struct _shared_string *next;
61 /* The top bit of "refcount" is used to signify that "u.array" points 64 /* The top bit of "refcount" is used to signify that "u.array" points
62 * at the array entry. 65 * at the array entry.
63 */ 66 */
66 * the padding when allocating memory. We assume here that 69 * the padding when allocating memory. We assume here that
67 * sizeof(long) is a good boundary. 70 * sizeof(long) is a good boundary.
68 */ 71 */
69 char string[PADDING]; 72 char string[PADDING];
70} shared_string; 73} shared_string;
74
75extern void init_hash_table(void);
76extern const char *add_string(const char *str);
77extern const char *add_refcount(const char *str);
78extern int query_refcount(const char *str);
79extern const char *find_string(const char *str);
80extern void free_string(const char *str);
81extern void ss_dump_statistics(void);
82extern const char *ss_dump_table(int what);
83extern int buf_overflow(const char *buf1, const char *buf2, int bufsize);
84
85#endif
86

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines