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

Function configvar_dup

common/configvar.c:170–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170struct 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
194struct configvar **configvar_join(const tal_t *ctx,
195 struct configvar **first,

Callers 1

configvar_joinFunction · 0.85

Calls 1

takenFunction · 0.85

Tested by

no test coverage detected