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.19 by root, Wed Sep 13 23:39:27 2006 UTC vs.
Revision 1.20 by root, Thu Sep 14 18:13:01 2006 UTC

44shstr::find (const char *s) 44shstr::find (const char *s)
45{ 45{
46 if (!s) 46 if (!s)
47 return s; 47 return s;
48 48
49 HT::iterator i = ht.find (s); 49 AUTODECL (i, ht.find (s));
50 50
51 return i != ht.end ()? *i : 0; 51 return i != ht.end ()? *i : 0;
52} 52}
53 53
54const char * 54const char *
73void 73void
74shstr::gc () 74shstr::gc ()
75{ 75{
76 static const char *curpos; 76 static const char *curpos;
77 77
78 HT::iterator i = curpos ? ht.find (curpos) : ht.begin (); 78 AUTODECL (i, curpos ? ht.find (curpos) : ht.begin ());
79 79
80 if (i == ht.end ()) 80 if (i == ht.end ())
81 i = ht.begin (); 81 i = ht.begin ();
82 82
83 // go through all strings roughly once every 4 minutes 83 // go through all strings roughly once every 4 minutes
92 } 92 }
93 else if (!--n) 93 else if (!--n)
94 break; 94 break;
95 else if (!refcnt (*i)) 95 else if (!refcnt (*i))
96 { 96 {
97 HT::iterator o = i++; 97 AUTODECL (o, i++);
98 const char *s = *o; 98 const char *s = *o;
99 99
100 ht.erase (o); 100 ht.erase (o);
101 101
102 //printf ("GC %4d %3d %d >%s<%d\n", (int)ht.size (), n, shstr::refcnt (s), s, shstr::length (s)); 102 //printf ("GC %4d %3d %d >%s<%d\n", (int)ht.size (), n, shstr::refcnt (s), s, shstr::length (s));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines