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

Function configvar_dup

common/configvar.c:165–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165struct 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
189struct configvar **configvar_join(const tal_t *ctx,
190 struct configvar **first,

Callers 1

configvar_joinFunction · 0.85

Calls 1

takenFunction · 0.85

Tested by

no test coverage detected