| 534 | |
| 535 | |
| 536 | static lu_mem traversetable (global_State *g, Table *h) { |
| 537 | const char *weakkey, *weakvalue; |
| 538 | const TValue *mode = gfasttm(g, h->metatable, TM_MODE); |
| 539 | markobjectN(g, h->metatable); |
| 540 | if (mode && ttisstring(mode) && /* is there a weak mode? */ |
| 541 | (cast_void(weakkey = strchr(svalue(mode), 'k')), |
| 542 | cast_void(weakvalue = strchr(svalue(mode), 'v')), |
| 543 | (weakkey || weakvalue))) { /* is really weak? */ |
| 544 | if (!weakkey) /* strong keys? */ |
| 545 | traverseweakvalue(g, h); |
| 546 | else if (!weakvalue) /* strong values? */ |
| 547 | traverseephemeron(g, h, 0); |
| 548 | else /* all weak */ |
| 549 | linkgclist(h, g->allweak); /* nothing to traverse now */ |
| 550 | } |
| 551 | else /* not weak */ |
| 552 | traversestrongtable(g, h); |
| 553 | return 1 + h->alimit + 2 * allocsizenode(h); |
| 554 | } |
| 555 | |
| 556 | |
| 557 | static int traverseudata (global_State *g, Udata *u) { |
no test coverage detected