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
@@ -224,7 +224,7 @@ builtin_lookup (struct dictionary *dict, void *handle, const char *req)
224 count *= ncol; 224 count *= ncol;
225 bds->wp = xcalloc (count, sizeof (bds->wp[0])); 225 bds->wp = xcalloc (count, sizeof (bds->wp[0]));
226 bds->acc = acc; 226 bds->acc = acc;
227 p = txtacc_finish (acc); 227 p = txtacc_finish (acc, 0);
228 228
229 for (i = 0; i < count; i++) 229 for (i = 0; i < count; i++)
230 { 230 {
diff --git a/src/cmdline.opt b/src/cmdline.opt
index afa1949..f92f48f 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -211,11 +211,15 @@ parse_options(int argc, char *argv[])
211 GETOPT(argc, argv) 211 GETOPT(argc, argv)
212 if (pp_cmd_acc && grecs_preprocessor) 212 if (pp_cmd_acc && grecs_preprocessor)
213 { 213 {
214 char *defs = txtacc_finish (pp_cmd_acc); 214 char *cmd;
215 char *cmd = xmalloc (strlen (grecs_preprocessor) + strlen (defs) + 1); 215 size_t len = strlen (grecs_preprocessor);
216 strcpy (cmd, grecs_preprocessor); 216 txtacc_1grow (pp_cmd_acc, 0);
217 strcat (cmd, defs); 217 txtacc_grow (pp_cmd_acc, grecs_preprocessor, len + 1);
218 grecs_preprocessor = cmd; 218 cmd = txtacc_finish (pp_cmd_acc, 1);
219 txtacc_free (pp_cmd_acc); 219 txtacc_free (pp_cmd_acc);
220 memmove (cmd + len + 1, cmd, strlen (cmd) + 1);
221 memcpy (cmd, grecs_preprocessor, len);
222 cmd[len] = ' ';
223 grecs_preprocessor = cmd;
220 } 224 }
221} 225}
diff --git a/src/directive.c b/src/directive.c
index 1f11d77..08a14df 100644
--- a/src/directive.c
+++ b/src/directive.c
@@ -511,7 +511,7 @@ run_check_script (const char *script, struct file_triplet *trp,
511 signal (SIGCHLD, oldsig); 511 signal (SIGCHLD, oldsig);
512 512
513 if (total) 513 if (total)
514 trp->check_diag = txtacc_finish (trp->acc); 514 trp->check_diag = txtacc_finish (trp->acc, 0);
515 515
516 trp->check_result = status; 516 trp->check_result = status;
517 if (WIFEXITED (status)) 517 if (WIFEXITED (status))
diff --git a/src/meta.c b/src/meta.c
index 61dc334..059fe6e 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -133,7 +133,7 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
133 txtacc_grow (acc, p, 1); 133 txtacc_grow (acc, p, 1);
134 } 134 }
135 txtacc_1grow (acc, 0); 135 txtacc_1grow (acc, 0);
136 res = xstrdup (txtacc_finish (acc)); 136 res = txtacc_finish (acc, 1);
137 txtacc_free (acc); 137 txtacc_free (acc);
138 return res; 138 return res;
139} 139}
diff --git a/src/process.c b/src/process.c
index 281c26b..e41709d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -36,7 +36,7 @@ register_spool (struct spool *spool)
36static int 36static int
37spool_check_alias (struct spool *spool, const char *name) 37spool_check_alias (struct spool *spool, const char *name)
38{ 38{
39 if (spool->aliases && grecs_list_locate (spool->aliases, name)) 39 if (spool->aliases && grecs_list_locate (spool->aliases, (char*) name))
40 return 1; 40 return 1;
41 return 0; 41 return 0;
42} 42}
diff --git a/src/report.c b/src/report.c
index 929bfff..0e87ac9 100644
--- a/src/report.c
+++ b/src/report.c
@@ -50,5 +50,5 @@ void
50report_finish () 50report_finish ()
51{ 51{
52 txtacc_1grow (report_acc, 0); 52 txtacc_1grow (report_acc, 0);
53 report_string = txtacc_finish (report_acc); 53 report_string = txtacc_finish (report_acc, 0);
54} 54}
diff --git a/src/triplet.c b/src/triplet.c
index c214385..3083c64 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -72,7 +72,7 @@ triplet_strdup (struct file_triplet *tp, const char *str)
72{ 72{
73 size_t len = strlen (str); 73 size_t len = strlen (str);
74 txtacc_grow (tp->acc, str, len + 1); 74 txtacc_grow (tp->acc, str, len + 1);
75 return txtacc_finish (tp->acc); 75 return txtacc_finish (tp->acc, 0);
76} 76}
77 77
78/* Register a file in the triplet table */ 78/* Register a file in the triplet table */
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)
121} 121}
122 122
123char * 123char *
124txtacc_finish (struct txtacc *acc) 124txtacc_finish (struct txtacc *acc, int steal)
125{ 125{
126 struct grecs_list_entry *ep; 126 struct grecs_list_entry *ep;
127 struct txtacc_entry *txtent; 127 struct txtacc_entry *txtent;
128 size_t size; 128 size_t size;
129 char *p;
129 130
130 switch (grecs_list_size (acc->cur)) 131 switch (grecs_list_size (acc->cur))
131 { 132 {
@@ -135,7 +136,6 @@ txtacc_finish (struct txtacc *acc)
135 case 1: 136 case 1:
136 txtent = acc->cur->head->data; 137 txtent = acc->cur->head->data;
137 acc->cur->head->data = NULL; 138 acc->cur->head->data = NULL;
138 grecs_list_append (acc->mem, txtent);
139 txtacc_entry_tailor (txtent); 139 txtacc_entry_tailor (txtent);
140 break; 140 break;
141 141
@@ -156,7 +156,12 @@ txtacc_finish (struct txtacc *acc)
156 } 156 }
157 157
158 grecs_list_clear (acc->cur); 158 grecs_list_clear (acc->cur);
159 return txtent->buf; 159 p = txtent->buf;
160 if (steal)
161 free (txtent);
162 else
163 grecs_list_append (acc->mem, txtent);
164 return p;
160} 165}
161 166
162void 167void
diff --git a/src/verify.c b/src/verify.c
index b3233e8..a49983c 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -171,7 +171,7 @@ fill_project_name (struct file_triplet *trp)
171 } 171 }
172 txtacc_grow (trp->acc, trp->relative_dir, len); 172 txtacc_grow (trp->acc, trp->relative_dir, len);
173 txtacc_1grow (trp->acc, 0); 173 txtacc_1grow (trp->acc, 0);
174 trp->project = txtacc_finish (trp->acc); 174 trp->project = txtacc_finish (trp->acc, 0);
175 } 175 }
176 else 176 else
177 trp->project = trp->relative_dir; 177 trp->project = trp->relative_dir;
diff --git a/src/wydawca.h b/src/wydawca.h
index ef1ff86..2307bad 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -567,4 +567,4 @@ void txtacc_grow (struct txtacc *acc, const char *buf, size_t size);
567 txtacc_grow (acc, &__ch, 1); \ 567 txtacc_grow (acc, &__ch, 1); \
568 } \ 568 } \
569 while (0) 569 while (0)
570char *txtacc_finish (struct txtacc *acc); 570char *txtacc_finish (struct txtacc *acc, int steal);

Return to:

Send suggestions and report system problems to the System administrator.