MCPcopy Create free account
hub / github.com/ZDoom/Raze / AddToHash

Method AddToHash

source/common/console/c_dispatch.cpp:422–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422bool FConsoleCommand::AddToHash (FConsoleCommand **table)
423{
424 unsigned int key;
425 FConsoleCommand *insert, **bucket;
426
427 key = MakeKey (m_Name.GetChars());
428 bucket = &table[key % HASH_SIZE];
429
430 if (ScanChainForName (*bucket, m_Name.GetChars(), m_Name.Len(), &insert))
431 {
432 return false;
433 }
434 else
435 {
436 if (insert)
437 {
438 m_Next = insert->m_Next;
439 if (m_Next)
440 m_Next->m_Prev = &m_Next;
441 insert->m_Next = this;
442 m_Prev = &insert->m_Next;
443 }
444 else
445 {
446 m_Next = *bucket;
447 *bucket = this;
448 m_Prev = bucket;
449 if (m_Next)
450 m_Next->m_Prev = &m_Next;
451 }
452 }
453 return true;
454}
455
456FConsoleCommand* FConsoleCommand::FindByName (const char* name)
457{

Callers

nothing calls this directly

Calls 3

ScanChainForNameFunction · 0.85
LenMethod · 0.80
GetCharsMethod · 0.45

Tested by

no test coverage detected