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
@@ -221,13 +221,13 @@ builtin_lookup (struct dictionary *dict, void *handle, const char *req)
221 char *p; 221 char *p;
222 222
223 bds = xmalloc (sizeof (*bds)); 223 bds = xmalloc (sizeof (*bds));
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 {
231 bds->wp[i] = p; 231 bds->wp[i] = p;
232 p += strlen (p) + 1; 232 p += strlen (p) + 1;
233 } 233 }
diff --git a/src/cmdline.opt b/src/cmdline.opt
index afa1949..f92f48f 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -208,14 +208,18 @@ OPTIONS_END
208void 208void
209parse_options(int argc, char *argv[]) 209parse_options(int argc, char *argv[])
210{ 210{
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
@@ -508,13 +508,13 @@ run_check_script (const char *script, struct file_triplet *trp,
508 fclose (fp); 508 fclose (fp);
509 509
510 waitpid (pid, &status, 0); 510 waitpid (pid, &status, 0);
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))
518 { 518 {
519 status = WEXITSTATUS (status); 519 status = WEXITSTATUS (status);
520 if (status) 520 if (status)
diff --git a/src/meta.c b/src/meta.c
index 61dc334..059fe6e 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -130,13 +130,13 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
130 } 130 }
131 } 131 }
132 else 132 else
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}
140 140
141void 141void
142meta_free (struct metadef *def) 142meta_free (struct metadef *def)
diff --git a/src/process.c b/src/process.c
index 281c26b..e41709d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -33,13 +33,13 @@ register_spool (struct spool *spool)
33 spool_list = sp; 33 spool_list = sp;
34} 34}
35 35
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}
43 43
44struct spool * 44struct spool *
45wydawca_find_spool (const char *name) 45wydawca_find_spool (const char *name)
diff --git a/src/report.c b/src/report.c
index 929bfff..0e87ac9 100644
--- a/src/report.c
+++ b/src/report.c
@@ -47,8 +47,8 @@ report_add (const char *fmt, ...)
47} 47}
48 48
49void 49void
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
@@ -69,13 +69,13 @@ hash_triplet_free (void *data)
69 69
70char * 70char *
71triplet_strdup (struct file_triplet *tp, const char *str) 71triplet_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 */
79void 79void
80register_file (struct file_info *finfo, const struct spool *spool) 80register_file (struct file_info *finfo, const struct spool *spool)
81{ 81{
diff --git a/src/txtacc.c b/src/txtacc.c
index c094c22..91659f6 100644
--- a/src/txtacc.c
+++ b/src/txtacc.c
@@ -118,27 +118,27 @@ txtacc_grow (struct txtacc *acc, const char *buf, size_t size)
118 buf += rest; 118 buf += rest;
119 size -= rest; 119 size -= rest;
120 } 120 }
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 {
132 case 0: 133 case 0:
133 return NULL; 134 return NULL;
134 135
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
142 default: 142 default:
143 size = 0; 143 size = 0;
144 for (ep = acc->cur->head; ep; ep = ep->next) 144 for (ep = acc->cur->head; ep; ep = ep->next)
@@ -153,13 +153,18 @@ txtacc_finish (struct txtacc *acc)
153 struct txtacc_entry *tp = ep->data; 153 struct txtacc_entry *tp = ep->data;
154 txtacc_entry_append (txtent, tp->buf, tp->len); 154 txtacc_entry_append (txtent, tp->buf, tp->len);
155 } 155 }
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
163txtacc_free_string (struct txtacc *acc, char *str) 168txtacc_free_string (struct txtacc *acc, char *str)
164{ 169{
165 struct grecs_list_entry *ep; 170 struct grecs_list_entry *ep;
diff --git a/src/verify.c b/src/verify.c
index b3233e8..a49983c 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -168,13 +168,13 @@ fill_project_name (struct file_triplet *trp)
168 logmsg (LOG_ERR, _("%s: empty `directory' directive"), 168 logmsg (LOG_ERR, _("%s: empty `directory' directive"),
169 trp->file[file_directive].name); 169 trp->file[file_directive].name);
170 return 1; 170 return 1;
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);</