Rewrite a string option. */
| 1300 | |
| 1301 | /* Rewrite a string option. */ |
| 1302 | void 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. */ |
| 1324 | void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const sds defvalue) { |
no test coverage detected