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