MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_FreeServerInfo

Function RM_FreeServerInfo

src/module.cpp:7313–7326  ·  view source on GitHub ↗

Free data created with RM_GetServerInfo(). You need to pass the * context pointer 'ctx' only if the dictionary was created using the * context instead of passing NULL. */

Source from the content-addressed store, hash-verified

7311 * context pointer 'ctx' only if the dictionary was created using the
7312 * context instead of passing NULL. */
7313void RM_FreeServerInfo(RedisModuleCtx *ctx, RedisModuleServerInfoData *data) {
7314 if (ctx != NULL) autoMemoryFreed(ctx,REDISMODULE_AM_INFO,data);
7315 raxIterator ri;
7316 raxStart(&ri,data->rax);
7317 while(1) {
7318 raxSeek(&ri,"^",NULL,0);
7319 if (!raxNext(&ri)) break;
7320 raxRemove(data->rax,(unsigned char*)ri.key,ri.key_len,NULL);
7321 sdsfree((sds)ri.data);
7322 }
7323 raxStop(&ri);
7324 raxFree(data->rax);
7325 zfree(data);
7326}
7327
7328/* Get the value of a field from data collected with RM_GetServerInfo(). You
7329 * need to pass the context pointer 'ctx' only if you want to use auto memory

Callers 1

autoMemoryCollectFunction · 0.85

Calls 9

autoMemoryFreedFunction · 0.85
raxStartFunction · 0.85
raxSeekFunction · 0.85
raxNextFunction · 0.85
raxRemoveFunction · 0.85
sdsfreeFunction · 0.85
raxStopFunction · 0.85
raxFreeFunction · 0.85
zfreeFunction · 0.85

Tested by

no test coverage detected