]> jfr.im git - irc/quakenet/newserv.git/blob - lib/sstring.h
CHANSERV: Added explicit message when allowing opers to issue commands on
[irc/quakenet/newserv.git] / lib / sstring.h
1 /* sstring.h - Declaration of "static strings" functions */
2
3 #ifndef __SSTRING_H
4 #define __SSTRING_H
5
6 #define SSTRING_COMPAT
7
8 #ifdef COMPILING_SSTRING
9
10 #ifdef SSTRING_NEW
11
12 /* this is here for compatibility reasons with old sstring */
13 /* this should be used when old sstring is removed entirely */
14 #ifdef SSTRING_COMPAT
15
16 typedef struct sstring {
17 char *content;
18 short length;
19 short alloc;
20 struct sstring *next;
21 #ifdef USE_VALGRIND
22 void *block;
23 #endif
24 unsigned long refcount;
25 char __content[];
26 } sstring;
27
28 #define sstring_content(x) (x)->__content
29
30 #else /* SSTRING_COMPAT */
31
32 typedef struct sstring {
33 short length;
34 short alloc;
35 struct sstring *next;
36 #ifdef USE_VALGRIND
37 void *block;
38 #endif
39 unsigned long refcount;
40 char content[];
41 } sstring;
42
43 #define sstring_content(x) (x)->content
44
45 #endif /* SSTRING_COMPAT */
46
47 #else /* SSTRING_NEW */
48
49 /* this is the old format */
50
51 /* Internal version of structure */
52 typedef struct {
53 char *content;
54 union {
55 struct {
56 short length;
57 short alloc;
58 } l;
59 void *next;
60 } u;
61 } sstring;
62
63 #endif /* SSTRING_NEW */
64
65 /* Internal defines */
66
67 /* SSTRING_MAXLEN is the internal version of SSTRING_MAX which includes
68 * space for the trailing NUL */
69 #define SSTRING_MAXLEN (SSTRING_MAX + 1)
70 #define SSTRING_SLACK 8
71
72 /* new sstring defines */
73 #define SSTRING_ALLOC 16384
74
75 #define SSTRING_HASHSIZE 85243
76
77 /* old sstring defines */
78 #define SSTRING_STRUCTALLOC 4096
79 #define SSTRING_DATAALLOC 4096
80
81 #else
82
83 typedef struct sstring {
84 char *content;
85 short length;
86 } sstring;
87
88 #endif /* COMPILING_SSTRING */
89
90 /* Externally visibly max string length */
91 #define SSTRING_MAX 512
92
93 sstring *getsstring(const char *, int);
94 void freesstring(sstring *);
95 int sstringcompare(sstring *ss1, sstring *ss2);
96 void initsstring();
97 void finisstring();
98
99 #endif /* __SSTRING_H */