MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / removeString

Method removeString

engine/source/network/netStringTable.cc:122–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void NetStringTable::removeString(U32 id, bool script)
123{
124 if(!script)
125 {
126 AssertFatal(table[id].refCount != 0, "Error, ref count is already 0!!");
127 if(--table[id].refCount)
128 return;
129 if(table[id].scriptRefCount)
130 return;
131 }
132 else
133 {
134 // If both ref counts are already 0, this id is not valid. Ignore
135 // the remove
136 if (table[id].scriptRefCount == 0 && table[id].refCount == 0)
137 return;
138
139 if(table[id].scriptRefCount == 0 && table[id].refCount)
140 {
141 Con::errorf("removeTaggedString failed! Ref count is already 0 for string: %s", table[id].string);
142 return;
143 }
144 if(--table[id].scriptRefCount)
145 return;
146 if(table[id].refCount)
147 return;
148 }
149 // unlink first:
150 U32 prev = table[id].prevLink;
151 U32 next = table[id].link;
152 if(next)
153 table[next].prevLink = prev;
154 if(prev)
155 table[prev].link = next;
156 else
157 firstValid = next;
158 // remove it from the hash table
159 U32 hash = _StringTable::hashString(table[id].string);
160 U32 bucket = hash % HashTableSize;
161 for(U32 *walk = &hashTable[bucket];*walk; walk = &table[*walk].next)
162 {
163 if(*walk == id)
164 {
165 *walk = table[id].next;
166 break;
167 }
168 }
169 table[id].next = firstFree;
170 firstFree = id;
171}
172
173void NetStringTable::repack()
174{

Callers 4

~NetStringHandleMethod · 0.80
setFromIndexMethod · 0.80
NetStringHandleClass · 0.80

Calls 1

errorfFunction · 0.85

Tested by

no test coverage detected