Rewrite a SDS string option. */
| 1322 | |
| 1323 | /* Rewrite a SDS string option. */ |
| 1324 | void 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. */ |
| 1346 | void rewriteConfigNumericalOption(struct rewriteConfigState *state, const char *option, long long value, long long defvalue) { |
no test coverage detected