| 481 | |
| 482 | |
| 483 | static lu_mem traversetable (global_State *g, Table *h) { |
| 484 | const char *weakkey, *weakvalue; |
| 485 | const TValue *mode = gfasttm(g, h->metatable, TM_MODE); |
| 486 | markobjectN(g, h->metatable); |
| 487 | if (mode && ttisstring(mode) && /* is there a weak mode? */ |
| 488 | (cast_void(weakkey = strchr(svalue(mode), 'k')), |
| 489 | cast_void(weakvalue = strchr(svalue(mode), 'v')), |
| 490 | (weakkey || weakvalue))) { /* is really weak? */ |
| 491 | black2gray(h); /* keep table gray */ |
| 492 | if (!weakkey) /* strong keys? */ |
| 493 | traverseweakvalue(g, h); |
| 494 | else if (!weakvalue) /* strong values? */ |
| 495 | traverseephemeron(g, h, 0); |
| 496 | else /* all weak */ |
| 497 | linkgclist(h, g->allweak); /* nothing to traverse now */ |
| 498 | } |
| 499 | else /* not weak */ |
| 500 | traversestrongtable(g, h); |
| 501 | return 1 + h->alimit + 2 * allocsizenode(h); |
| 502 | } |
| 503 | |
| 504 | |
| 505 | static int traverseudata (global_State *g, Udata *u) { |
no test coverage detected