--- deliantra/server/common/shstr.C 2006/09/12 00:53:56 1.16 +++ deliantra/server/common/shstr.C 2006/09/13 23:39:27 1.19 @@ -1,4 +1,3 @@ - /* * shstr.C */ @@ -12,18 +11,16 @@ #include "global.h" -typedef std::tr1::unordered_set HT; +typedef std::tr1::unordered_set , true> HT; static HT ht; static const char * makevec (const char *s) { - int - len = strlen (s); + int len = strlen (s); - const char * - v = (const char *) (2 + (int *) g_slice_alloc (sizeof (int) * 2 + len + 1)); + const char *v = (const char *) (2 + (int *)g_slice_alloc (sizeof (int) * 2 + len + 1)); shstr::length (v) = len; shstr::refcnt (v) = 1; @@ -33,7 +30,15 @@ return v; } -const char *shstr::null = makevec (""); +static const char * +makenull () +{ + const char *s = makevec ("(null)"); + shstr::length (s) = 0; + return s; +} + +const char *shstr::null = makenull (); const char * shstr::find (const char *s) @@ -68,9 +73,6 @@ void shstr::gc () { -return; //D -//D currently disabled: some datastructures might still store them -//D but their pointers will become invalidated static const char *curpos; HT::iterator i = curpos ? ht.find (curpos) : ht.begin ();