- set_string_field(conf, conf->variable, newval);
- changed = true;
- }
- conf->gen.source = newsource;
- /* Release stacked values if not used anymore */
- set_string_field(conf, &stack->value.stringval,
- NULL);
- set_string_field(conf, &stack->tentative_val.stringval,
- NULL);
- /* Don't store tentative value separately after commit */
- if (nestLevel == 1)
- set_string_field(conf, &conf->tentative_val, NULL);
- break;
+ if (*conf->variable != newval)
+ {
+ if (conf->assign_hook)
+ if (!(*conf->assign_hook) (newval,
+ true, PGC_S_OVERRIDE))
+ elog(LOG, "failed to commit %s",
+ conf->gen.name);
+ *conf->variable = newval;
+ changed = true;
+ }
+ break;
+ }
+ case PGC_STRING:
+ {
+ struct config_string *conf = (struct config_string *) gconf;
+ char *newval = newvalue.stringval;
+
+ if (*conf->variable != newval)
+ {
+ if (conf->assign_hook && newval)
+ {
+ const char *newstr;
+
+ newstr = (*conf->assign_hook) (newval, true,
+ PGC_S_OVERRIDE);
+ if (newstr == NULL)
+ elog(LOG, "failed to commit %s",
+ conf->gen.name);
+ else if (newstr != newval)
+ {
+ /*
+ * If newval should now be freed,
+ * it'll be taken care of below.
+ *
+ * See notes in set_config_option
+ * about casting
+ */
+ newval = (char *) newstr;
+ }
+ }
+
+ set_string_field(conf, conf->variable, newval);
+ changed = true;
+ }
+
+ /*
+ * Release stacked values if not used anymore. We
+ * could use discard_stack_value() here, but since
+ * we have type-specific code anyway, might as
+ * well inline it.
+ */
+ set_string_field(conf, &stack->prior.stringval, NULL);
+ set_string_field(conf, &stack->masked.stringval, NULL);
+ break;
+ }