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

Function rewriteConfigSdsOption

app/redis-6.2.6/src/config.c:1324–1343  ·  view source on GitHub ↗

Rewrite a SDS string option. */

Source from the content-addressed store, hash-verified

1322
1323/* Rewrite a SDS string option. */
1324void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const sds defvalue) {
1325 int force = 1;
1326 sds line;
1327
1328 /* If there is no value set, we don't want the SDS option
1329 * to be present in the configuration at all. */
1330 if (value == NULL) {
1331 rewriteConfigMarkAsProcessed(state, option);
1332 return;
1333 }
1334
1335 /* Set force to zero if the value is set to its default. */
1336 if (defvalue && sdscmp(value, defvalue) == 0) force = 0;
1337
1338 line = sdsnew(option);
1339 line = sdscatlen(line, " ", 1);
1340 line = sdscatrepr(line, value, sdslen(value));
1341
1342 rewriteConfigRewriteLine(state, option, line, force);
1343}
1344
1345/* Rewrite a numerical (long long range) option. */
1346void rewriteConfigNumericalOption(struct rewriteConfigState *state, const char *option, long long value, long long defvalue) {

Callers 1

sdsConfigRewriteFunction · 0.85

Calls 7

sdscmpFunction · 0.85
sdsnewFunction · 0.85
sdscatlenFunction · 0.85
sdscatreprFunction · 0.85
sdslenFunction · 0.85
rewriteConfigRewriteLineFunction · 0.85

Tested by

no test coverage detected