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

Function rewriteConfigStringOption

src/config.cpp:1553–1572  ·  view source on GitHub ↗

Rewrite a string option. */

Source from the content-addressed store, hash-verified

1551
1552/* Rewrite a string option. */
1553void rewriteConfigStringOption(struct rewriteConfigState *state, const char *option, const char *value, const char *defvalue) {
1554 int force = 1;
1555 sds line;
1556
1557 /* String options set to NULL need to be not present at all in the
1558 * configuration file to be set to NULL again at the next reboot. */
1559 if (value == NULL) {
1560 rewriteConfigMarkAsProcessed(state,option);
1561 return;
1562 }
1563
1564 /* Set force to zero if the value is set to its default. */
1565 if (defvalue && strcmp(value,defvalue) == 0) force = 0;
1566
1567 line = sdsnew(option);
1568 line = sdscatlen(line, " ", 1);
1569 line = sdscatrepr(line, value, strlen(value));
1570
1571 rewriteConfigRewriteLine(state,option,line,force);
1572}
1573
1574/* Rewrite a SDS string option. */
1575void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const sds defvalue) {

Callers 3

rewriteConfigDirOptionFunction · 0.85
rewriteConfigFunction · 0.85
stringConfigRewriteFunction · 0.85

Calls 5

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

Tested by

no test coverage detected