--- deliantra/server/common/shstr.C 2006/09/12 00:26:16 1.15 +++ 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,13 +31,15 @@ return v; } -const char * - shstr::null = makevec (""); - -// what weird misoptimisation is this again? -const shstr undead_name ("undead"); +static const char * +makenull () +{ + const char *s = makevec ("(null)"); + shstr::length (s) = 0; + return s; +} -shstr skill_names[NUM_SKILLS]; +const char *shstr::null = makenull (); const char * shstr::find (const char *s) @@ -119,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