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.16 by root, Tue Sep 12 00:53:56 2006 UTC vs.
Revision 1.17 by root, Tue Sep 12 19:20:06 2006 UTC

17static HT ht; 17static HT ht;
18 18
19static const char * 19static const char *
20makevec (const char *s) 20makevec (const char *s)
21{ 21{
22 int
23 len = strlen (s); 22 int len = strlen (s);
24 23
25 const char *
26 v = (const char *) (2 + (int *) g_slice_alloc (sizeof (int) * 2 + len + 1)); 24 const char *v = (const char *) (2 + (int *) g_slice_alloc (sizeof (int) * 2 + len + 1));
27 25
28 shstr::length (v) = len; 26 shstr::length (v) = len;
29 shstr::refcnt (v) = 1; 27 shstr::refcnt (v) = 1;
30 28
31 memcpy ((char *) v, s, len + 1); 29 memcpy ((char *) v, s, len + 1);
32 30
33 return v; 31 return v;
34} 32}
35 33
34static const char *
35makenull ()
36{
37 const char *s = makevec ("(null)");
38 shstr::length (s) = 0;
39 return s;
40}
41
36const char *shstr::null = makevec ("<nil>"); 42const char *shstr::null = makenull ();
37 43
38const char * 44const char *
39shstr::find (const char *s) 45shstr::find (const char *s)
40{ 46{
41 if (!s) 47 if (!s)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines