** search function for strings */
| 508 | ** search function for strings |
| 509 | */ |
| 510 | static 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 | |
| 535 | const TValue *luaH_getstr(Table *t, TString *key) { |
no test coverage detected