diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-13 10:21:43 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-13 10:33:34 +0300 |
commit | de3fbe3e8d4dd2a89f7755906d76055784c437cc (patch) | |
tree | 65356dd7b5a9010499550c468e960c93515a7e15 /src/txtacc.c | |
parent | f569a6f2628b9ddef4dfb4424aff2dad644a8f19 (diff) | |
download | wydawca-de3fbe3e8d4dd2a89f7755906d76055784c437cc.tar.gz wydawca-de3fbe3e8d4dd2a89f7755906d76055784c437cc.tar.bz2 |
Drop gnulib.
* bootstrap: Rewrite.
* bootstrap.conf: Remove.
* configure.ac: Remove gl_EARLY/gl_INIT
* src/backup.c: New file.
* src/txtacc.c (txtacc_finish): Make sure a new entry is
appended only once to the list.
* (all sources): Use grecs memory allocation functions.
* src/wydawca.h" Include fnmatch.h and regex.h
(backup_type): New enum.
(simple_backup_suffix): New extern.
(find_backup_file_name): New proto.
* tests/bkupname.c: New file.
* tests/backup00.at: New file.
* tests/backup01.at: New file.
* tests/backup02.at: New file.
* tests/backup03.at: New file.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Add new tests.
* grecs: Update.
Diffstat (limited to 'src/txtacc.c')
-rw-r--r-- | src/txtacc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/txtacc.c b/src/txtacc.c index 91659f6..442e27e 100644 --- a/src/txtacc.c +++ b/src/txtacc.c | |||
@@ -34,8 +34,8 @@ struct txtacc | |||
34 | static struct txtacc_entry * | 34 | static struct txtacc_entry * |
35 | txtacc_alloc_entry (struct grecs_list *list, size_t size) | 35 | txtacc_alloc_entry (struct grecs_list *list, size_t size) |
36 | { | 36 | { |
37 | struct txtacc_entry *p = xmalloc (sizeof (*p)); | 37 | struct txtacc_entry *p = grecs_malloc (sizeof (*p)); |
38 | p->buf = xmalloc (size); | 38 | p->buf = grecs_malloc (size); |
39 | p->size = size; | 39 | p->size = size; |
40 | p->len = 0; | 40 | p->len = 0; |
41 | grecs_list_append (list, p); | 41 | grecs_list_append (list, p); |
@@ -89,7 +89,7 @@ txtacc_entry_free (void *p) | |||
89 | struct txtacc * | 89 | struct txtacc * |
90 | txtacc_create () | 90 | txtacc_create () |
91 | { | 91 | { |
92 | struct txtacc *acc = xmalloc (sizeof (*acc)); | 92 | struct txtacc *acc = grecs_malloc (sizeof (*acc)); |
93 | acc->cur = grecs_list_create (); | 93 | acc->cur = grecs_list_create (); |
94 | acc->cur->free_entry = txtacc_entry_free; | 94 | acc->cur->free_entry = txtacc_entry_free; |
95 | acc->mem = grecs_list_create (); | 95 | acc->mem = grecs_list_create (); |
@@ -137,6 +137,7 @@ txtacc_finish (struct txtacc *acc, int steal) | |||
137 | txtent = acc->cur->head->data; | 137 | txtent = acc->cur->head->data; |
138 | acc->cur->head->data = NULL; | 138 | acc->cur->head->data = NULL; |
139 | txtacc_entry_tailor (txtent); | 139 | txtacc_entry_tailor (txtent); |
140 | grecs_list_append (acc->mem, txtent); | ||
140 | break; | 141 | break; |
141 | 142 | ||
142 | default: | 143 | default: |
@@ -158,9 +159,10 @@ txtacc_finish (struct txtacc *acc, int steal) | |||
158 | grecs_list_clear (acc->cur); | 159 | grecs_list_clear (acc->cur); |
159 | p = txtent->buf; | 160 | p = txtent->buf; |
160 | if (steal) | 161 | if (steal) |
161 | free (txtent); | 162 | { |
162 | else | 163 | grecs_list_remove_tail (acc->mem); |
163 | grecs_list_append (acc->mem, txtent); | 164 | free (txtent); |
165 | } | ||
164 | return p; | 166 | return p; |
165 | } | 167 | } |
166 | 168 | ||
@@ -173,7 +175,7 @@ txtacc_free_string (struct txtacc *acc, char *str) | |||
173 | struct txtacc_entry *tp = ep->data; | 175 | struct txtacc_entry *tp = ep->data; |
174 | if (tp->buf == str) | 176 | if (tp->buf == str) |
175 | { | 177 | { |
176 | grecs_list_remove_entry(acc->mem, ep); | 178 | grecs_list_remove_entry (acc->mem, ep); |
177 | free (tp->buf); | 179 | free (tp->buf); |
178 | return; | 180 | return; |
179 | } | 181 | } |