This is O(N^2) but nobody cares */
| 99 | |
| 100 | /* This is O(N^2) but nobody cares */ |
| 101 | void 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 | |
| 129 | void configvar_remove(struct configvar ***cvs, |
| 130 | const char *name, |
no test coverage detected