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

Method lookupn

engine/source/string/stringTable.cc:193–212  ·  view source on GitHub ↗

--------------------------------------

Source from the content-addressed store, hash-verified

191
192//--------------------------------------
193StringTableEntry _StringTable::lookupn(const char* val, S32 len, const bool caseSens)
194{
195 if ( val == NULL )
196 return StringTable->EmptyString;
197
198 MutexHandle mutex;
199 mutex.lock(&mMutex, true);
200
201 Node **walk, *temp;
202 U32 key = hashStringn(val, len);
203 walk = &buckets[key % numBuckets];
204 while((temp = *walk) != NULL) {
205 if(caseSens && !dStrncmp(temp->val, val, len) && temp->val[len] == 0)
206 return temp->val;
207 else if(!caseSens && !dStrnicmp(temp->val, val, len) && temp->val[len] == 0)
208 return temp->val;
209 walk = &(temp->next);
210 }
211 return NULL;
212}
213
214//--------------------------------------
215void _StringTable::resize(const U32 newSize)

Callers 3

findObjectMethod · 0.80
findObjectFunction · 0.80
findObjectMethod · 0.80

Calls 3

dStrncmpFunction · 0.70
dStrnicmpFunction · 0.50
lockMethod · 0.45

Tested by

no test coverage detected