MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / iscleared

Function iscleared

deps/lua/src/lgc.c:337–345  ·  view source on GitHub ↗

** The next function tells whether a key or value can be cleared from ** a weak table. Non-collectable objects are never removed from weak ** tables. Strings behave as `values', so are never removed too. for ** other objects: if really collected, cannot keep them; for userdata ** being finalized, keep them in keys, but not in values */

Source from the content-addressed store, hash-verified

335** being finalized, keep them in keys, but not in values
336*/
337static int iscleared (const TValue *o, int iskey) {
338 if (!iscollectable(o)) return 0;
339 if (ttisstring(o)) {
340 stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */
341 return 0;
342 }
343 return iswhite(gcvalue(o)) ||
344 (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o))));
345}
346
347
348/*

Callers 1

cleartableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected