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

Function configvar_finalize_overrides

common/configvar.c:101–127  ·  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 /* If you're allowed multiple, they don't override...
111 * unless transient values exist, which override non-transient. */
112 if (opts[i]->type & OPT_MULTI) {
113 if (cvs[i]->src != CONFIGVAR_SETCONFIG_TRANSIENT)
114 continue;
115 for (size_t j = 0; j < i; j++) {
116 if (opts[j] == opts[i] &&
117 cvs[j]->src != CONFIGVAR_SETCONFIG_TRANSIENT)
118 cvs[j]->overridden = true;
119 }
120 continue;
121 }
122 for (size_t j = 0; j < i; j++) {
123 if (opts[j] == opts[i])
124 cvs[j]->overridden = true;
125 }
126 }
127}
128
129void configvar_remove(struct configvar ***cvs,
130 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