| 163 | } |
| 164 | |
| 165 | struct configvar *configvar_dup(const tal_t *ctx, const struct configvar *cv) |
| 166 | { |
| 167 | struct configvar *ret; |
| 168 | |
| 169 | if (taken(cv)) |
| 170 | return tal_steal(ctx, cast_const(struct configvar *, cv)); |
| 171 | |
| 172 | ret = tal_dup(ctx, struct configvar, cv); |
| 173 | if (ret->file) |
| 174 | ret->file = tal_strdup(ret, ret->file); |
| 175 | if (ret->configline) |
| 176 | ret->configline = tal_strdup(ret, ret->configline); |
| 177 | if (ret->optvar) { |
| 178 | ret->optvar = tal_strdup(ret, ret->optvar); |
| 179 | /* Optarg, if non-NULL, points into cmdline! */ |
| 180 | if (ret->optarg) { |
| 181 | size_t off = cv->optarg - cv->configline; |
| 182 | assert(off < strlen(cv->configline)); |
| 183 | ret->optarg = ret->configline + off; |
| 184 | } |
| 185 | } |
| 186 | return ret; |
| 187 | } |
| 188 | |
| 189 | struct configvar **configvar_join(const tal_t *ctx, |
| 190 | struct configvar **first, |
no test coverage detected