aboutsummaryrefslogtreecommitdiff
path: root/src/txtacc.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-12 00:05:00 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-12 00:05:00 +0300
commitf569a6f2628b9ddef4dfb4424aff2dad644a8f19 (patch)
tree6d6e5b03bc97198c2002703591fe5e751978130c /src/txtacc.c
parent590e208c40797206fd6a93651fc59e0b68eeb545 (diff)
downloadwydawca-f569a6f2628b9ddef4dfb4424aff2dad644a8f19.tar.gz
wydawca-f569a6f2628b9ddef4dfb4424aff2dad644a8f19.tar.bz2
Improve the txtacc interface.
Diffstat (limited to 'src/txtacc.c')
-rw-r--r--src/txtacc.c11
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
@@ -121,11 +121,12 @@ txtacc_grow (struct txtacc *acc, const char *buf, size_t size)
}
char *
-txtacc_finish (struct txtacc *acc)
+txtacc_finish (struct txtacc *acc, int steal)
{
struct grecs_list_entry *ep;
struct txtacc_entry *txtent;
size_t size;
+ char *p;
switch (grecs_list_size (acc->cur))
{
@@ -135,7 +136,6 @@ txtacc_finish (struct txtacc *acc)
case 1:
txtent = acc->cur->head->data;
acc->cur->head->data = NULL;
- grecs_list_append (acc->mem, txtent);
txtacc_entry_tailor (txtent);
break;
@@ -156,7 +156,12 @@ 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;
}
void

Return to:

Send suggestions and report system problems to the System administrator.