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

Function rewriteConfigStringOption

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

Rewrite a string option. */

Source from the content-addressed store, hash-verified

1300
1301/* Rewrite a string option. */
1302void rewriteConfigStringOption(struct rewriteConfigState *state, const char *option, char *value, const char *defvalue) {
1303 int force = 1;
1304 sds line;
1305
1306 /* String options set to NULL need to be not present at all in the
1307 * configuration file to be set to NULL again at the next reboot. */
1308 if (value == NULL) {
1309 rewriteConfigMarkAsProcessed(state,option);
1310 return;
1311 }
1312
1313 /* Set force to zero if the value is set to its default. */
1314 if (defvalue && strcmp(value,defvalue) == 0) force = 0;
1315
1316 line = sdsnew(option);
1317 line = sdscatlen(line, " ", 1);
1318 line = sdscatrepr(line, value, strlen(value));
1319
1320 rewriteConfigRewriteLine(state,option,line,force);
1321}
1322
1323/* Rewrite a SDS string option. */
1324void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const sds defvalue) {

Callers 3

rewriteConfigDirOptionFunction · 0.85
rewriteConfigFunction · 0.85
stringConfigRewriteFunction · 0.85

Calls 6

strcmpFunction · 0.85
sdsnewFunction · 0.85
sdscatlenFunction · 0.85
sdscatreprFunction · 0.85
rewriteConfigRewriteLineFunction · 0.85

Tested by

no test coverage detected