Crossfire Server, Trunk  1.75.0
sstring.h
Go to the documentation of this file.
1 #pragma once
2 typedef const char *sstring;
3 
4 /* shstr.cpp */
5 extern void init_hash_table(void);
6 extern sstring add_string(const char *str);
7 extern sstring add_refcount(sstring str);
8 extern int query_refcount(sstring str);
9 extern sstring find_string(const char *str);
10 extern void free_string(sstring str);
11 extern void ss_dump_statistics(char *buf, size_t size);
12 extern char *ss_dump_table(int what, char *buf, size_t size);
13 extern int buf_overflow(const char *buf1, const char *buf2, size_t bufsize);
add_refcount
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
Definition: shstr.cpp:224
ss_dump_statistics
void ss_dump_statistics(char *buf, size_t size)
A call to this function will cause the statistics to be dumped into specified buffer.
Definition: shstr.cpp:337
init_hash_table
void init_hash_table(void)
Initialises the hash-table used by the shared string library.
Definition: shstr.cpp:69
buf
StringBuffer * buf
Definition: readable.cpp:1565
buf_overflow
int buf_overflow(const char *buf1, const char *buf2, size_t bufsize)
We don't want to exceed the buffer size of buf1 by adding on buf2!
Definition: shstr.cpp:412
query_refcount
int query_refcount(sstring str)
This will return the refcount of the string str.
Definition: shstr.cpp:238
add_string
sstring add_string(const char *str)
Share a string.
Definition: shstr.cpp:137
ss_dump_table
char * ss_dump_table(int what, char *buf, size_t size)
Dump the contents of the share string tables.
Definition: shstr.cpp:368
find_string
sstring find_string(const char *str)
Searches a string in the shared strings.
Definition: shstr.cpp:250
free_string
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
Definition: shstr.cpp:294
sstring
const typedef char * sstring
Definition: sstring.h:2