]> jfr.im git - irc/quakenet/newserv.git/blob - lib/sstring.h
sync R from D back into this branch
[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 /* Externally visibly max string length */
7 #define SSTRING_MAX 512
8
9 #ifdef COMPILING_SSTRING
10 /* Internal version of structure */
11 typedef struct {
12 char *content;
13 union {
14 struct {
15 short length;
16 short alloc;
17 } l;
18 void *next;
19 } u;
20 } sstring;
21
22 /* Internal defines */
23
24 /* SSTRING_MAXLEN is the internal version of SSTRING_MAX which includes
25 * space for the trailing NUL */
26 #define SSTRING_MAXLEN (SSTRING_MAX + 1)
27 #define SSTRING_SLACK 8
28 #define SSTRING_STRUCTALLOC 4096
29 #define SSTRING_DATAALLOC 4096
30
31 #else
32 /* External (simpler) version */
33
34 typedef struct {
35 char *content;
36 short length;
37 } sstring;
38
39 #endif /* COMPILING_SSTRING */
40
41 sstring *getsstring(const char *, int);
42 void freesstring(sstring *);
43 int sstringcompare(sstring *ss1, sstring *ss2);
44 void initsstring();
45 void finisstring();
46
47 #endif /* __SSTRING_H */