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. */
| 162 | * receives a pointer to the dict* and implicitly updates it when the dict |
| 163 | * struct itself was moved. Returns a stat of how many pointers were moved. */ |
| 164 | long dictDefragTables(dict* d) { |
| 165 | dictEntry **newtable; |
| 166 | long defragged = 0; |
| 167 | /* handle the first hash table */ |
| 168 | newtable = activeDefragAlloc(d->ht[0].table); |
| 169 | if (newtable) |
| 170 | defragged++, d->ht[0].table = newtable; |
| 171 | /* handle the second hash table */ |
| 172 | if (d->ht[1].table) { |
| 173 | newtable = activeDefragAlloc(d->ht[1].table); |
| 174 | if (newtable) |
| 175 | defragged++, d->ht[1].table = newtable; |
| 176 | } |
| 177 | return defragged; |
| 178 | } |
| 179 | |
| 180 | /* Internal function used by zslDefrag */ |
| 181 | void zslUpdateNode(zskiplist *zsl, zskiplistNode *oldnode, zskiplistNode *newnode, zskiplistNode **update) { |
no test coverage detected