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.4 by root, Thu Aug 31 17:54:14 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines