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

Function mallctl_string

app/redis-6.2.6/src/debug.c:357–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357void mallctl_string(client *c, robj **argv, int argc) {
358 int rret, wret;
359 char *old;
360 size_t sz = sizeof(old);
361 /* for strings, it seems we need to first get the old value, before overriding it. */
362 if ((rret=je_mallctl(argv[0]->ptr, &old, &sz, NULL, 0))) {
363 /* return error unless this option is write only. */
364 if (!(rret == EPERM && argc > 1)) {
365 addReplyErrorFormat(c,"%s", strerror(rret));
366 return;
367 }
368 }
369 if(argc > 1) {
370 char *val = argv[1]->ptr;
371 char **valref = &val;
372 if ((!strcmp(val,"VOID")))
373 valref = NULL, sz = 0;
374 wret = je_mallctl(argv[0]->ptr, NULL, 0, valref, sz);
375 }
376 if (!rret)
377 addReplyBulkCString(c, old);
378 else if (wret)
379 addReplyErrorFormat(c,"%s", strerror(wret));
380 else
381 addReply(c, shared.ok);
382}
383#endif
384
385void debugCommand(client *c) {

Callers 1

debugCommandFunction · 0.85

Calls 5

je_mallctlFunction · 0.85
addReplyErrorFormatFunction · 0.85
strcmpFunction · 0.85
addReplyBulkCStringFunction · 0.85
addReplyFunction · 0.85

Tested by

no test coverage detected