Defrag helper for dict main allocations (dict struct, and hash tables). * receives a pointer to the dict* and implicitly updates it when the dict * struct itself was moved. Returns a stat of how many pointers were moved. */
| 185 | * receives a pointer to the dict* and implicitly updates it when the dict |
| 186 | * struct itself was moved. Returns a stat of how many pointers were moved. */ |
| 187 | long dictDefragTables(dict* d) { |
| 188 | dictEntry **newtable; |
| 189 | long defragged = 0; |
| 190 | /* handle the first hash table */ |
| 191 | newtable = (dictEntry**)activeDefragAlloc(d->ht[0].table); |
| 192 | if (newtable) |
| 193 | defragged++, d->ht[0].table = newtable; |
| 194 | /* handle the second hash table */ |
| 195 | if (d->ht[1].table) { |
| 196 | newtable = (dictEntry**)activeDefragAlloc(d->ht[1].table); |
| 197 | if (newtable) |
| 198 | defragged++, d->ht[1].table = newtable; |
| 199 | } |
| 200 | return defragged; |
| 201 | } |
| 202 | |
| 203 | /* Internal function used by zslDefrag */ |
| 204 | void zslUpdateNode(zskiplist *zsl, zskiplistNode *oldnode, zskiplistNode *newnode, zskiplistNode **update) { |
no test coverage detected