mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
bkpr: cleanup csv_safe_str
This commit is contained in:
@@ -777,7 +777,7 @@ void *tal_dup_(const tal_t *ctx, const void *p, size_t size,
|
||||
(void)taken(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (!adjust_size(&nbytes, n)) {
|
||||
if (taken(p))
|
||||
tal_free(p);
|
||||
|
||||
@@ -115,13 +115,13 @@ static char *csv_safe_str(const tal_t *ctx, char *input TAKES)
|
||||
char *dupe;
|
||||
|
||||
/* Update the double-quotes in place */
|
||||
dupe = tal_strdup(ctx, input);
|
||||
dupe = tal_strdup(tmpctx, input);
|
||||
for (size_t i = 0; dupe[i] != '\0'; i++) {
|
||||
if (dupe[i] == '"')
|
||||
dupe[i] = '\'';
|
||||
}
|
||||
|
||||
esc = json_escape(ctx, dupe);
|
||||
esc = json_escape(tmpctx, take(dupe));
|
||||
return tal_fmt(ctx, "\"%s\"", esc->s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user