MCPcopy Create free account
hub / github.com/ElementsProject/lightning / configvar_finalize_overrides

Function configvar_finalize_overrides

common/configvar.c:101–132  ·  view source on GitHub ↗

This is O(N^2) but nobody cares */

Source from the content-addressed store, hash-verified

99
100/* This is O(N^2) but nobody cares */
101void configvar_finalize_overrides(struct configvar **cvs)
102{
103 /* Map to options: two different names can be the same option,
104 * given aliases! */
105 const struct opt_table **opts;
106
107 opts = tal_arr(tmpctx, const struct opt_table *, tal_count(cvs));
108 for (size_t i = 0; i < tal_count(cvs); i++) {
109 opts[i] = opt_find_long(cvs[i]->optvar, NULL);
110 /* The plugin which registered this option may have
111 * disabled itself since: leave the stale configvar alone,
112 * it can still be reused if that plugin is started again. */
113 if (!opts[i])
114 continue;
115 /* If you're allowed multiple, they don't override...
116 * unless transient values exist, which override non-transient. */
117 if (opts[i]->type & OPT_MULTI) {
118 if (cvs[i]->src != CONFIGVAR_SETCONFIG_TRANSIENT)
119 continue;
120 for (size_t j = 0; j < i; j++) {
121 if (opts[j] == opts[i] &&
122 cvs[j]->src != CONFIGVAR_SETCONFIG_TRANSIENT)
123 cvs[j]->overridden = true;
124 }
125 continue;
126 }
127 for (size_t j = 0; j < i; j++) {
128 if (opts[j] == opts[i])
129 cvs[j]->overridden = true;
130 }
131 }
132}
133
134void configvar_remove(struct configvar ***cvs,
135 const char *name,

Callers 3

plugin_add_paramsFunction · 0.85
configvar_updatedFunction · 0.85
parse_configvars_finalFunction · 0.85

Calls 1

opt_find_longFunction · 0.85

Tested by

no test coverage detected