ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/shstr.C
(Generate patch)

Comparing deliantra/server/common/shstr.C (file contents):
Revision 1.3 by root, Sun Sep 3 00:18:40 2006 UTC vs.
Revision 1.4 by root, Sun Sep 3 08:05:39 2006 UTC

49static HT ht; 49static HT ht;
50 50
51const char * 51const char *
52shstr::find (const char *s) 52shstr::find (const char *s)
53{ 53{
54 if (!s)
55 return s;
56
54 HT::iterator i = ht.find (s); 57 HT::iterator i = ht.find (s);
55 58
56 return i != ht.end () 59 return i != ht.end ()
57 ? (char *)*i 60 ? (char *)*i
58 : 0; 61 : 0;
59} 62}
60 63
61const char * 64const char *
62shstr::intern (const char *s) 65shstr::intern (const char *s)
63{ 66{
64 HT::iterator i = ht.find (s); 67 if (!s)
68 return s;
65 69
66 if (i != ht.end ()) 70 if (const char *found = find (s))
67 return (char *)*i; 71 return found;
68 72
69 int len = strlen (s); 73 int len = strlen (s);
70 74
71 int *v = (int *)malloc (sizeof (int) * 2 + len + 1); 75 int *v = (int *)malloc (sizeof (int) * 2 + len + 1);
72 76

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines