aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------grecs0
-rw-r--r--src/builtin.c2
-rw-r--r--src/cmdline.opt14
-rw-r--r--src/directive.c2
-rw-r--r--src/meta.c2
-rw-r--r--src/process.c2
-rw-r--r--src/report.c2
-rw-r--r--src/triplet.c2
-rw-r--r--src/txtacc.c11
-rw-r--r--src/verify.c2
-rw-r--r--src/wydawca.h2
11 files changed, 25 insertions, 16 deletions
diff --git a/grecs b/grecs
-Subproject 3e5d6e9683d5d3efa3a82556d0f73892d674ed7
+Subproject f8ca129aaf4876dfa9778c34ed5bd8a669ca22e
diff --git a/src/builtin.c b/src/builtin.c
index 0a76738..9d1063c 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -226,3 +226,3 @@ builtin_lookup (struct dictionary *dict, void *handle, const char *req)
bds->acc = acc;
- p = txtacc_finish (acc);
+ p = txtacc_finish (acc, 0);
diff --git a/src/cmdline.opt b/src/cmdline.opt
index afa1949..f92f48f 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -213,8 +213,12 @@ parse_options(int argc, char *argv[])
{
- char *defs = txtacc_finish (pp_cmd_acc);
- char *cmd = xmalloc (strlen (grecs_preprocessor) + strlen (defs) + 1);
- strcpy (cmd, grecs_preprocessor);
- strcat (cmd, defs);
- grecs_preprocessor = cmd;
+ char *cmd;
+ size_t len = strlen (grecs_preprocessor);
+ txtacc_1grow (pp_cmd_acc, 0);
+ txtacc_grow (pp_cmd_acc, grecs_preprocessor, len + 1);
+ cmd = txtacc_finish (pp_cmd_acc, 1);
txtacc_free (pp_cmd_acc);
+ memmove (cmd + len + 1, cmd, strlen (cmd) + 1);
+ memcpy (cmd, grecs_preprocessor, len);
+ cmd[len] = ' ';
+ grecs_preprocessor = cmd;
}
diff --git a/src/directive.c b/src/directive.c
index 1f11d77..08a14df 100644
--- a/src/directive.c
+++ b/src/directive.c
@@ -513,3 +513,3 @@ run_check_script (const char *script, struct file_triplet *trp,
if (total)
- trp->check_diag = txtacc_finish (trp->acc);
+ trp->check_diag = txtacc_finish (trp->acc, 0);
diff --git a/src/meta.c b/src/meta.c
index 61dc334..059fe6e 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -135,3 +135,3 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
txtacc_1grow (acc, 0);
- res = xstrdup (txtacc_finish (acc));
+ res = txtacc_finish (acc, 1);
txtacc_free (acc);
diff --git a/src/process.c b/src/process.c
index 281c26b..e41709d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -38,3 +38,3 @@ spool_check_alias (struct spool *spool, const char *name)
{
- if (spool->aliases && grecs_list_locate (spool->aliases, name))
+ if (spool->aliases && grecs_list_locate (spool->aliases, (char*) name))
return 1;
diff --git a/src/report.c b/src/report.c
index 929bfff..0e87ac9 100644
--- a/src/report.c
+++ b/src/report.c
@@ -52,3 +52,3 @@ report_finish ()
txtacc_1grow (report_acc, 0);
- report_string = txtacc_finish (report_acc);
+ report_string = txtacc_finish (report_acc, 0);
}
diff --git a/src/triplet.c b/src/triplet.c
index c214385..3083c64 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -74,3 +74,3 @@ triplet_strdup (struct file_triplet *tp, const char *str)
txtacc_grow (tp->acc, str, len + 1);
- return txtacc_finish (tp->acc);
+ return txtacc_finish (tp->acc, 0);
}
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;
}
diff --git a/src/verify.c b/src/verify.c
index b3233e8..a49983c 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -173,3 +173,3 @@ fill_project_name (struct file_triplet *trp)
txtacc_1grow (trp->acc, 0);
- trp->project = txtacc_finish (trp->acc);
+ trp->project = txtacc_finish (trp->acc, 0);
}
diff --git a/src/wydawca.h b/src/wydawca.h
index ef1ff86..2307bad 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -569,2 +569,2 @@ void txtacc_grow (struct txtacc *acc, const char *buf, size_t size);
while (0)
-char *txtacc_finish (struct txtacc *acc);
+char *txtacc_finish (struct txtacc *acc, int steal);

Return to:

Send suggestions and report system problems to the System administrator.