--- deliantra/server/common/shstr.C 2006/09/10 16:00:23 1.13 +++ deliantra/server/common/shstr.C 2006/09/12 19:20:06 1.17 @@ -10,26 +10,18 @@ #include -#include "shstr.h" -#include "util.h" +#include "global.h" -typedef -std::tr1::unordered_set < const char *, - str_hash, - str_equal > - HT; +typedef std::tr1::unordered_set HT; -static HT - 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; @@ -39,11 +31,15 @@ return v; } -const char * - shstr::null = makevec (""); +static const char * +makenull () +{ + const char *s = makevec ("(null)"); + shstr::length (s) = 0; + return s; +} -// what weird misoptimisation is this again? -const shstr undead_name ("undead"); +const char *shstr::null = makenull (); const char * shstr::find (const char *s) @@ -78,6 +74,9 @@ 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 (); @@ -114,6 +113,11 @@ curpos = *i; } +shstr skill_names[NUM_SKILLS]; + +// what weird misoptimisation is this again? +const shstr undead_name ("undead"); + //TODO: this should of course not be here /* buf_overflow() - we don't want to exceed the buffer size of