Defrag helper for sds strings * * returns NULL in case the allocation wasn't moved. * when it returns a non-null value, the old pointer was already released * and should NOT be accessed. */
| 76 | * when it returns a non-null value, the old pointer was already released |
| 77 | * and should NOT be accessed. */ |
| 78 | sds activeDefragSds(sds sdsptr) { |
| 79 | void* ptr = sdsAllocPtr(sdsptr); |
| 80 | void* newptr = activeDefragAlloc(ptr); |
| 81 | if (newptr) { |
| 82 | size_t offset = sdsptr - (char*)ptr; |
| 83 | sdsptr = (char*)newptr + offset; |
| 84 | return sdsptr; |
| 85 | } |
| 86 | return NULL; |
| 87 | } |
| 88 | |
| 89 | /* Defrag helper for robj and/or string objects |
| 90 | * |
no test coverage detected