MCPcopy Create free account
hub / github.com/F-Stack/f-stack / activeDefragSds

Function activeDefragSds

app/redis-6.2.6/src/defrag.c:78–87  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

76 * when it returns a non-null value, the old pointer was already released
77 * and should NOT be accessed. */
78sds 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 *

Callers 9

activeDefragStringObFunction · 0.85
activeDefragZsetEntryFunction · 0.85
activeDefragSdsDictFunction · 0.85
activeDefragListFunction · 0.85
scanLaterSetCallbackFunction · 0.85
scanLaterHashCallbackFunction · 0.85
defragStreamConsumerFunction · 0.85
defragKeyFunction · 0.85

Calls 2

sdsAllocPtrFunction · 0.85
activeDefragAllocFunction · 0.85

Tested by

no test coverage detected