MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / getfreepos

Function getfreepos

third-party/lua-5.5.0/src/ltable.c:829–847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827
828
829static Node *getfreepos (Table *t) {
830 if (haslastfree(t)) { /* does it have 'lastfree' information? */
831 /* look for a spot before 'lastfree', updating 'lastfree' */
832 while (getlastfree(t) > t->node) {
833 Node *free = --getlastfree(t);
834 if (keyisnil(free))
835 return free;
836 }
837 }
838 else { /* no 'lastfree' information */
839 unsigned i = sizenode(t);
840 while (i--) { /* do a linear search */
841 Node *free = gnode(t, i);
842 if (keyisnil(free))
843 return free;
844 }
845 }
846 return NULL; /* could not find a free place */
847}
848
849
850

Callers 1

insertkeyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected