MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxFindKey

Function fxFindKey

xs/sources/xsMemory.c:488–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488txSlot* fxFindKey(txMachine* the)
489{
490#if mxKeysGarbageCollection
491 txBoolean once = 1;
492#endif
493 txID id;
494 txSlot* result;
495more:
496 id = the->keyIndex;
497 if (id < the->keyCount) {
498 result = fxNewSlot(the);
499 result->ID = id;
500 the->keyArray[id - the->keyOffset] = result;
501 the->keyIndex++;
502 return result;
503 }
504#if mxKeysGarbageCollection
505again:
506 result = the->keyholeList;
507 if (result) {
508 the->keyholeCount--;
509 the->keyholeList = result->next;
510 result->next = C_NULL;
511 return result;
512 }
513 if (once) {
514 fxCollect(the, XS_COLLECT_KEYS_FLAG | XS_ORGANIC_FLAG);
515 once = 0;
516 goto again;
517 }
518#endif
519 else {
520 fxGrowKeys(the, 1);
521 goto more;
522 }
523 return C_NULL;
524}
525
526void fxFree(txMachine* the)
527{

Callers 7

fxBuildKeysFunction · 0.85
fx_SymbolFunction · 0.85
fx_Symbol_forFunction · 0.85
fxNewNameFunction · 0.85
fxNewNameCFunction · 0.85
fxNewNameXFunction · 0.85
fxBuildKeysFunction · 0.85

Calls 3

fxNewSlotFunction · 0.85
fxCollectFunction · 0.85
fxGrowKeysFunction · 0.85

Tested by

no test coverage detected