mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: use C++ versions of membuffer in add_to_string
Avoid explicit calls to free(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e65ba50c1a
commit
84b7ffafd2
1 changed files with 1 additions and 3 deletions
|
@ -309,12 +309,10 @@ void put_quoted(struct membuffer *b, const char *text, int is_attribute, int is_
|
|||
char *add_to_string_va(char *old, const char *fmt, va_list args)
|
||||
{
|
||||
char *res;
|
||||
struct membuffer o = { 0 }, n = { 0 };
|
||||
struct membufferpp o, n;
|
||||
put_vformat(&n, fmt, args);
|
||||
put_format(&o, "%s\n%s", old ?: "", mb_cstring(&n));
|
||||
res = strdup(mb_cstring(&o));
|
||||
free_buffer(&o);
|
||||
free_buffer(&n);
|
||||
free((void *)old);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue