diff options
Diffstat (limited to 'src/txtacc.c')
-rw-r--r-- | src/txtacc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/txtacc.c b/src/txtacc.c index c094c22..91659f6 100644 --- a/src/txtacc.c +++ b/src/txtacc.c @@ -123,3 +123,3 @@ txtacc_grow (struct txtacc *acc, const char *buf, size_t size) char * -txtacc_finish (struct txtacc *acc) +txtacc_finish (struct txtacc *acc, int steal) { @@ -128,2 +128,3 @@ txtacc_finish (struct txtacc *acc) size_t size; + char *p; @@ -137,3 +138,2 @@ txtacc_finish (struct txtacc *acc) acc->cur->head->data = NULL; - grecs_list_append (acc->mem, txtent); txtacc_entry_tailor (txtent); @@ -158,3 +158,8 @@ txtacc_finish (struct txtacc *acc) grecs_list_clear (acc->cur); - return txtent->buf; + p = txtent->buf; + if (steal) + free (txtent); + else + grecs_list_append (acc->mem, txtent); + return p; } |