MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaH_getstr_int

Function luaH_getstr_int

lua/ltable.c:510–532  ·  view source on GitHub ↗

** search function for strings */

Source from the content-addressed store, hash-verified

508** search function for strings
509*/
510static const TValue *luaH_getstr_int (Table *t, TString *key,
511 TValue **foundkey) {
512 Node *n = hashstr(t, key);
513 do { /* check whether `key' is somewhere in the chain */
514 if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) {
515 if (foundkey)
516 *foundkey = key2tval(n);
517 return gval(n); /* that's it */
518 }
519 else if (ttype(gkey(n)) == LUA_TUSERDATA) {
520 void *raw = rawuvalue(key2tval(n)) + 1;
521 const char *c; size_t l;
522 if (luabb_hashinfo(raw, NULL, &c, &l) == String
523 && strcmp(c, getstr(key)) == 0) {
524 if (foundkey)
525 *foundkey = key2tval(n);
526 return gval(n); /* that's it */
527 }
528 }
529 n = gnext(n);
530 } while (n);
531 return luaO_nilobject;
532}
533
534
535const TValue *luaH_getstr(Table *t, TString *key) {

Callers 2

luaH_getstrFunction · 0.85
luaH_get_intFunction · 0.85

Calls 2

luabb_hashinfoFunction · 0.85
getstrFunction · 0.85

Tested by

no test coverage detected