aboutsummaryrefslogtreecommitdiff
path: root/src/txtacc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/txtacc.c')
-rw-r--r--src/txtacc.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/txtacc.c b/src/txtacc.c
index a8fa002..f416006 100644
--- a/src/txtacc.c
+++ b/src/txtacc.c
@@ -106,9 +106,9 @@ void
grecs_txtacc_free(struct grecs_txtacc *acc)
{
if (acc) {
- grecs_list_free (acc->cur);
- grecs_list_free (acc->mem);
- free (acc);
+ grecs_list_free(acc->cur);
+ grecs_list_free(acc->mem);
+ free(acc);
}
}
@@ -126,6 +126,22 @@ grecs_txtacc_grow(struct grecs_txtacc *acc, const char *buf, size_t size)
}
}
+void
+grecs_txtacc_grow_string(struct grecs_txtacc *acc, const char *buf)
+{
+ grecs_txtacc_grow(acc, buf, strlen(buf));
+}
+
+void
+grecs_txtacc_grow_string_escape(struct grecs_txtacc *acc, const char *buf)
+{
+ for (; *buf; buf++) {
+ if (strchr(" \t\n\"\'\\", *buf))
+ grecs_txtacc_grow_char(acc, '\\');
+ grecs_txtacc_grow_char(acc, *buf);
+ }
+}
+
char *
grecs_txtacc_finish(struct grecs_txtacc *acc, int steal)
{

Return to:

Send suggestions and report system problems to the System administrator.