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.53 by root, Sat Nov 17 23:40:00 2018 UTC vs.
Revision 1.55 by root, Sat Dec 1 20:22:12 2018 UTC

76shstr::find (const char *s) 76shstr::find (const char *s)
77{ 77{
78 if (!s) 78 if (!s)
79 return s; 79 return s;
80 80
81 auto (i, ht.find (s)); 81 auto i = ht.find (s);
82 82
83 return i != ht.end ()? *i : 0; 83 return i != ht.end ()? *i : 0;
84} 84}
85 85
86const char * 86const char *
109 if (expect_true (next_gc > 0)) 109 if (expect_true (next_gc > 0))
110 return; 110 return;
111 111
112 static const char *curpos; 112 static const char *curpos;
113 113
114 auto (i, curpos ? ht.find (curpos) : ht.begin ()); 114 auto i = curpos ? ht.find (curpos) : ht.begin ();
115 115
116 if (i == ht.end ()) 116 if (i == ht.end ())
117 i = ht.begin (); 117 i = ht.begin ();
118 118
119 int n = ht.size () / 256 + 16; 119 int n = ht.size () / 256 + 16;
128 } 128 }
129 else if (!--n) 129 else if (!--n)
130 break; 130 break;
131 else if (!refcnt (*i)) 131 else if (!refcnt (*i))
132 { 132 {
133 auto (o, i++);
134 const char *s = *o; 133 const char *s = *i;
135 134
136 ht.erase (o); 135 i = ht.erase (i);
137 136
138 //printf ("GC %4d %3d %d >%s<%d\n", (int)ht.size (), n, shstr::refcnt (s), s, shstr::length (s)); 137 //printf ("GC %4d %3d %d >%s<%d\n", (int)ht.size (), n, shstr::refcnt (s), s, shstr::length (s));
139 int alloc = sizeof (uint32_t) * NUM_INT + length (s) + 1; 138 int alloc = sizeof (uint32_t) * NUM_INT + length (s) + 1;
140 shstr_alloc -= alloc; 139 shstr_alloc -= alloc;
141 g_slice_free1 (alloc, (void *)(s - sizeof (uint32_t) * NUM_INT)); 140 g_slice_free1 (alloc, (void *)(s - sizeof (uint32_t) * NUM_INT));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines