Commit b54540cb b54540cbbc95069b6d073246a575683170920275 by Sergey Poznyakoff

Improve opool API

* configure.ac: Version 2.99.993
* NEWS: Update.

* include/mailutils/opool.h (MU_OPOOL_DEFAULT)
(MU_OPOOL_ENOMEMABRT): New defines.
(mu_opool_create): Change meaning of the 2nd argument. All uses updated.
(mu_opool_free, mu_opool_dup): New proto.
* libmailutils/base/opool.c (_mu_opool) <memerr>: Replace with flags.
<head,tail,free>: Rename.
(mu_opool_free, mu_opool_dup): New functions.
(mu_opool_head): Bugfix.
1 parent c6848f52
1 GNU mailutils NEWS -- history of user-visible changes. 2016-10-28 1 GNU mailutils NEWS -- history of user-visible changes. 2016-10-30
2 Copyright (C) 2002-2016 Free Software Foundation, Inc. 2 Copyright (C) 2002-2016 Free Software Foundation, Inc.
3 See the end of file for copying conditions. 3 See the end of file for copying conditions.
4 4
5 Please send mailutils bug reports to <bug-mailutils@gnu.org>. 5 Please send mailutils bug reports to <bug-mailutils@gnu.org>.
6 6
7 7
8 Version 2.99.992 (Git) 8 Version 2.99.993 (Git)
9 9
10 This version is a major rewrite of GNU Mailutils. Quite a few parts 10 This version is a major rewrite of GNU Mailutils. Quite a few parts
11 of the basic framework were rewritten from scratch, while some others 11 of the basic framework were rewritten from scratch, while some others
......
...@@ -144,7 +144,7 @@ expand_line (const char *str, mu_message_t msg) ...@@ -144,7 +144,7 @@ expand_line (const char *str, mu_message_t msg)
144 144
145 if (!*str) 145 if (!*str)
146 return NULL; 146 return NULL;
147 mu_opool_create (&pool, 1); 147 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
148 for (p = str; *p; p++) 148 for (p = str; *p; p++)
149 { 149 {
150 switch (*p) 150 switch (*p)
......
...@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License along ...@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License along
16 dnl with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. 16 dnl with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
17 17
18 AC_PREREQ(2.63) 18 AC_PREREQ(2.63)
19 AC_INIT([GNU Mailutils], [2.99.992], [bug-mailutils@gnu.org], [mailutils], 19 AC_INIT([GNU Mailutils], [2.99.993], [bug-mailutils@gnu.org], [mailutils],
20 [http://mailutils.org]) 20 [http://mailutils.org])
21 AC_CONFIG_SRCDIR([libmailutils/mailbox/mailbox.c]) 21 AC_CONFIG_SRCDIR([libmailutils/mailbox/mailbox.c])
22 AC_CONFIG_AUX_DIR([build-aux]) 22 AC_CONFIG_AUX_DIR([build-aux])
......
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
24 # define MU_OPOOL_BUCKET_SIZE 1024 24 # define MU_OPOOL_BUCKET_SIZE 1024
25 #endif 25 #endif
26 26
27 /* Create an object pool. If MEMERR is not 0, any operation of the 27 /* Flags for mu_opool_create call: */
28 resulting pool (including mu_opool_create itself) will abort on 28 #define MU_OPOOL_DEFAULT 0
29 not enough memory condition, using mu_alloc_die. */ 29 #define MU_OPOOL_ENOMEMABRT 0x01 /* Abort on ENOMEM error */
30 int mu_opool_create (mu_opool_t *pret, int memerr); 30
31 /* Create an object pool. */
32 int mu_opool_create (mu_opool_t *pret, int flags);
31 int mu_opool_set_bucket_size (mu_opool_t opool, size_t size); 33 int mu_opool_set_bucket_size (mu_opool_t opool, size_t size);
32 int mu_opool_get_bucket_size (mu_opool_t opool, size_t *psize); 34 int mu_opool_get_bucket_size (mu_opool_t opool, size_t *psize);
33 35
...@@ -39,6 +41,10 @@ int mu_opool_union (mu_opool_t *dst, mu_opool_t *src); ...@@ -39,6 +41,10 @@ int mu_opool_union (mu_opool_t *dst, mu_opool_t *src);
39 begin a new object. */ 41 begin a new object. */
40 void mu_opool_clear (mu_opool_t opool); 42 void mu_opool_clear (mu_opool_t opool);
41 43
44 /* Free object OBJ from the pool. If OBJ is NULL, free all created objects,
45 including the one being built */
46 void mu_opool_free (mu_opool_t pool, void *obj);
47
42 /* Destroy the pool, reclaim any memory associated with it. */ 48 /* Destroy the pool, reclaim any memory associated with it. */
43 void mu_opool_destroy (mu_opool_t *popool); 49 void mu_opool_destroy (mu_opool_t *popool);
44 50
...@@ -80,6 +86,10 @@ void *mu_opool_head (mu_opool_t opool, size_t *psize); ...@@ -80,6 +86,10 @@ void *mu_opool_head (mu_opool_t opool, size_t *psize);
80 return p; */ 86 return p; */
81 void *mu_opool_finish (mu_opool_t opool, size_t *psize); 87 void *mu_opool_finish (mu_opool_t opool, size_t *psize);
82 88
89 /* Append SIZE bytes from DATA to the pool and return the pointer to the
90 created object. */
91 void *mu_opool_dup (mu_opool_t pool, void const *data, size_t size);
92
83 int mu_opool_get_iterator (mu_opool_t opool, mu_iterator_t *piterator); 93 int mu_opool_get_iterator (mu_opool_t opool, mu_iterator_t *piterator);
84 94
85 #endif 95 #endif
......
...@@ -686,7 +686,7 @@ display_stream_mailcap (const char *ident, mu_stream_t stream, mu_header_t hdr, ...@@ -686,7 +686,7 @@ display_stream_mailcap (const char *ident, mu_stream_t stream, mu_header_t hdr,
686 mailcap_path = mailcap_path_tmp; 686 mailcap_path = mailcap_path_tmp;
687 } 687 }
688 688
689 mu_opool_create (&expand_pool, 1); 689 mu_opool_create (&expand_pool, MU_OPOOL_ENOMEMABRT);
690 690
691 ws.ws_delim = ":"; 691 ws.ws_delim = ":";
692 if (mu_wordsplit (mailcap_path, &ws, 692 if (mu_wordsplit (mailcap_path, &ws,
......
...@@ -41,11 +41,11 @@ struct mu_opool_bucket ...@@ -41,11 +41,11 @@ struct mu_opool_bucket
41 41
42 struct _mu_opool 42 struct _mu_opool
43 { 43 {
44 int memerr; 44 int flags; /* Flag bits */
45 size_t bucket_size; 45 size_t bucket_size; /* Default bucket size */
46 size_t itr_count; 46 size_t itr_count; /* Number of iterators created for this pool */
47 struct mu_opool_bucket *head, *tail; 47 struct mu_opool_bucket *bkt_head, *bkt_tail;
48 struct mu_opool_bucket *free; 48 struct mu_opool_bucket *bkt_fini; /* List of finished objects */
49 }; 49 };
50 50
51 static struct mu_opool_bucket * 51 static struct mu_opool_bucket *
...@@ -54,7 +54,7 @@ alloc_bucket (struct _mu_opool *opool, size_t size) ...@@ -54,7 +54,7 @@ alloc_bucket (struct _mu_opool *opool, size_t size)
54 struct mu_opool_bucket *p = malloc (sizeof (*p) + size); 54 struct mu_opool_bucket *p = malloc (sizeof (*p) + size);
55 if (!p) 55 if (!p)
56 { 56 {
57 if (opool->memerr) 57 if (opool->flags & MU_OPOOL_ENOMEMABRT)
58 mu_alloc_die (); 58 mu_alloc_die ();
59 } 59 }
60 else 60 else
...@@ -73,11 +73,11 @@ alloc_pool (mu_opool_t opool, size_t size) ...@@ -73,11 +73,11 @@ alloc_pool (mu_opool_t opool, size_t size)
73 struct mu_opool_bucket *p = alloc_bucket (opool, opool->bucket_size); 73 struct mu_opool_bucket *p = alloc_bucket (opool, opool->bucket_size);
74 if (!p) 74 if (!p)
75 return ENOMEM; 75 return ENOMEM;
76 if (opool->tail) 76 if (opool->bkt_tail)
77 opool->tail->next = p; 77 opool->bkt_tail->next = p;
78 else 78 else
79 opool->head = p; 79 opool->bkt_head = p;
80 opool->tail = p; 80 opool->bkt_tail = p;
81 return 0; 81 return 0;
82 } 82 }
83 83
...@@ -86,32 +86,32 @@ copy_chars (mu_opool_t opool, const char *str, size_t n, size_t *psize) ...@@ -86,32 +86,32 @@ copy_chars (mu_opool_t opool, const char *str, size_t n, size_t *psize)
86 { 86 {
87 size_t rest; 87 size_t rest;
88 88
89 if (!opool->head || opool->tail->level == opool->tail->size) 89 if (!opool->bkt_head || opool->bkt_tail->level == opool->bkt_tail->size)
90 if (alloc_pool (opool, opool->bucket_size)) 90 if (alloc_pool (opool, opool->bucket_size))
91 return ENOMEM; 91 return ENOMEM;
92 rest = opool->tail->size - opool->tail->level; 92 rest = opool->bkt_tail->size - opool->bkt_tail->level;
93 if (n > rest) 93 if (n > rest)
94 n = rest; 94 n = rest;
95 memcpy (opool->tail->buf + opool->tail->level, str, n); 95 memcpy (opool->bkt_tail->buf + opool->bkt_tail->level, str, n);
96 opool->tail->level += n; 96 opool->bkt_tail->level += n;
97 *psize = n; 97 *psize = n;
98 return 0; 98 return 0;
99 } 99 }
100 100
101 int 101 int
102 mu_opool_create (mu_opool_t *pret, int memerr) 102 mu_opool_create (mu_opool_t *pret, int flags)
103 { 103 {
104 struct _mu_opool *x = malloc (sizeof (x[0])); 104 struct _mu_opool *x = malloc (sizeof (x[0]));
105 if (!x) 105 if (!x)
106 { 106 {
107 if (memerr) 107 if (flags & MU_OPOOL_ENOMEMABRT)
108 mu_alloc_die (); 108 mu_alloc_die ();
109 return ENOMEM; 109 return ENOMEM;
110 } 110 }
111 x->memerr = memerr; 111 x->flags = flags;
112 x->bucket_size = MU_OPOOL_BUCKET_SIZE; 112 x->bucket_size = MU_OPOOL_BUCKET_SIZE;
113 x->itr_count = 0; 113 x->itr_count = 0;
114 x->head = x->tail = x->free = 0; 114 x->bkt_head = x->bkt_tail = x->bkt_fini = NULL;
115 *pret = x; 115 *pret = x;
116 return 0; 116 return 0;
117 } 117 }
...@@ -140,11 +140,11 @@ mu_opool_clear (mu_opool_t opool) ...@@ -140,11 +140,11 @@ mu_opool_clear (mu_opool_t opool)
140 if (!opool) 140 if (!opool)
141 return; 141 return;
142 142
143 if (opool->tail) 143 if (opool->bkt_tail)
144 { 144 {
145 opool->tail->next = opool->free; 145 opool->bkt_tail->next = opool->bkt_fini;
146 opool->free = opool->head; 146 opool->bkt_fini = opool->bkt_head;
147 opool->head = opool->tail = NULL; 147 opool->bkt_head = opool->bkt_tail = NULL;
148 } 148 }
149 } 149 }
150 150
...@@ -156,15 +156,15 @@ mu_opool_destroy (mu_opool_t *popool) ...@@ -156,15 +156,15 @@ mu_opool_destroy (mu_opool_t *popool)
156 { 156 {
157 mu_opool_t opool = *popool; 157 mu_opool_t opool = *popool;
158 mu_opool_clear (opool); 158 mu_opool_clear (opool);
159 for (p = opool->free; p; ) 159 for (p = opool->bkt_fini; p; )
160 { 160 {
161 struct mu_opool_bucket *next = p->next; 161 struct mu_opool_bucket *next = p->next;
162 free (p); 162 free (p);
163 p = next; 163 p = next;
164 } 164 }
165 free (opool); 165 free (opool);
166 *popool = NULL;
166 } 167 }
167 *popool = NULL;
168 } 168 }
169 169
170 int 170 int
...@@ -174,13 +174,13 @@ mu_opool_alloc (mu_opool_t opool, size_t size) ...@@ -174,13 +174,13 @@ mu_opool_alloc (mu_opool_t opool, size_t size)
174 { 174 {
175 size_t rest; 175 size_t rest;
176 176
177 if (!opool->head || opool->tail->level == opool->tail->size) 177 if (!opool->bkt_head || opool->bkt_tail->level == opool->bkt_tail->size)
178 if (alloc_pool (opool, opool->bucket_size)) 178 if (alloc_pool (opool, opool->bucket_size))
179 return ENOMEM; 179 return ENOMEM;
180 rest = opool->tail->size - opool->tail->level; 180 rest = opool->bkt_tail->size - opool->bkt_tail->level;
181 if (size < rest) 181 if (size < rest)
182 rest = size; 182 rest = size;
183 opool->tail->level += rest; 183 opool->bkt_tail->level += rest;
184 size -= rest; 184 size -= rest;
185 } 185 }
186 return 0; 186 return 0;
...@@ -218,7 +218,7 @@ mu_opool_size (mu_opool_t opool) ...@@ -218,7 +218,7 @@ mu_opool_size (mu_opool_t opool)
218 { 218 {
219 size_t size = 0; 219 size_t size = 0;
220 struct mu_opool_bucket *p; 220 struct mu_opool_bucket *p;
221 for (p = opool->head; p; p = p->next) 221 for (p = opool->bkt_head; p; p = p->next)
222 size += p->level; 222 size += p->level;
223 return size; 223 return size;
224 } 224 }
...@@ -230,7 +230,7 @@ mu_opool_copy (mu_opool_t opool, void *buf, size_t size) ...@@ -230,7 +230,7 @@ mu_opool_copy (mu_opool_t opool, void *buf, size_t size)
230 size_t total = 0; 230 size_t total = 0;
231 struct mu_opool_bucket *p; 231 struct mu_opool_bucket *p;
232 232
233 for (p = opool->head; p && total < size; p = p->next) 233 for (p = opool->bkt_head; p && total < size; p = p->next)
234 { 234 {
235 size_t cpsize = size - total; 235 size_t cpsize = size - total;
236 if (cpsize > p->level) 236 if (cpsize > p->level)
...@@ -249,27 +249,28 @@ mu_opool_coalesce (mu_opool_t opool, size_t *psize) ...@@ -249,27 +249,28 @@ mu_opool_coalesce (mu_opool_t opool, size_t *psize)
249 249
250 if (opool->itr_count) 250 if (opool->itr_count)
251 return MU_ERR_FAILURE; 251 return MU_ERR_FAILURE;
252 if (opool->head && opool->head->next == NULL) 252 if (opool->bkt_head && opool->bkt_head->next == NULL)
253 size = opool->head->level; 253 size = opool->bkt_head->level;
254 else { 254 else
255 struct mu_opool_bucket *bucket; 255 {
256 struct mu_opool_bucket *p; 256 struct mu_opool_bucket *bucket;
257 struct mu_opool_bucket *p;
257 258
258 size = mu_opool_size (opool); 259 size = mu_opool_size (opool);
259 260
260 bucket = alloc_bucket (opool, size); 261 bucket = alloc_bucket (opool, size);
261 if (!bucket) 262 if (!bucket)
262 return ENOMEM; 263 return ENOMEM;
263 for (p = opool->head; p; ) 264 for (p = opool->bkt_head; p; )
264 { 265 {
265 struct mu_opool_bucket *next = p->next; 266 struct mu_opool_bucket *next = p->next;
266 memcpy (bucket->buf + bucket->level, p->buf, p->level); 267 memcpy (bucket->buf + bucket->level, p->buf, p->level);
267 bucket->level += p->level; 268 bucket->level += p->level;
268 free (p); 269 free (p);
269 p = next; 270 p = next;
270 } 271 }
271 opool->head = opool->tail = bucket; 272 opool->bkt_head = opool->bkt_tail = bucket;
272 } 273 }
273 if (psize) 274 if (psize)
274 *psize = size; 275 *psize = size;
275 return 0; 276 return 0;
...@@ -278,9 +279,9 @@ mu_opool_coalesce (mu_opool_t opool, size_t *psize) ...@@ -278,9 +279,9 @@ mu_opool_coalesce (mu_opool_t opool, size_t *psize)
278 void * 279 void *
279 mu_opool_head (mu_opool_t opool, size_t *psize) 280 mu_opool_head (mu_opool_t opool, size_t *psize)
280 { 281 {
281 if (*psize) 282 if (psize)
282 *psize = opool->head ? opool->head->level : 0; 283 *psize = opool->bkt_head ? opool->bkt_head->level : 0;
283 return opool->head ? opool->head->buf : NULL; 284 return opool->bkt_head ? opool->bkt_head->buf : NULL;
284 } 285 }
285 286
286 void * 287 void *
...@@ -289,7 +290,48 @@ mu_opool_finish (mu_opool_t opool, size_t *psize) ...@@ -289,7 +290,48 @@ mu_opool_finish (mu_opool_t opool, size_t *psize)
289 if (mu_opool_coalesce (opool, psize)) 290 if (mu_opool_coalesce (opool, psize))
290 return NULL; 291 return NULL;
291 mu_opool_clear (opool); 292 mu_opool_clear (opool);
292 return opool->free->buf; 293 return opool->bkt_fini->buf;
294 }
295
296 void
297 mu_opool_free (mu_opool_t pool, void *obj)
298 {
299 if (!pool)
300 return;
301 if (!obj)
302 {
303 if (pool->bkt_head)
304 mu_opool_finish (pool, NULL);
305 while (pool->bkt_fini)
306 {
307 struct mu_opool_bucket *next = pool->bkt_fini->next;
308 free (pool->bkt_fini);
309 pool->bkt_fini = next;
310 }
311 }
312 else
313 {
314 struct mu_opool_bucket *bucket = pool->bkt_fini, **pprev = &pool->bkt_fini;
315 while (bucket)
316 {
317 if (bucket->buf == obj)
318 {
319 *pprev = bucket->next;
320 free (bucket);
321 return;
322 }
323 pprev = &bucket->next;
324 bucket = bucket->next;
325 }
326 }
327 }
328
329 void *
330 mu_opool_dup (mu_opool_t pool, void const *data, size_t size)
331 {
332 if (mu_opool_append (pool, data, size))
333 return NULL;
334 return mu_opool_finish (pool, NULL);
293 } 335 }
294 336
295 int 337 int
...@@ -314,20 +356,20 @@ mu_opool_union (mu_opool_t *pdst, mu_opool_t *psrc) ...@@ -314,20 +356,20 @@ mu_opool_union (mu_opool_t *pdst, mu_opool_t *psrc)
314 else 356 else
315 dst = *pdst; 357 dst = *pdst;
316 358
317 if (dst->tail) 359 if (dst->bkt_tail)
318 dst->tail->next = src->head; 360 dst->bkt_tail->next = src->bkt_head;
319 else 361 else
320 dst->head = src->head; 362 dst->bkt_head = src->bkt_head;
321 dst->tail = src->tail; 363 dst->bkt_tail = src->bkt_tail;
322 364
323 if (src->free) 365 if (src->bkt_fini)
324 { 366 {
325 struct mu_opool_bucket *p; 367 struct mu_opool_bucket *p;
326 368
327 for (p = src->free; p->next; p = p->next) 369 for (p = src->bkt_fini; p->next; p = p->next)
328 ; 370 ;
329 p->next = dst->free; 371 p->next = dst->bkt_fini;
330 dst->free = src->free; 372 dst->bkt_fini = src->bkt_fini;
331 } 373 }
332 374
333 free (src); 375 free (src);
...@@ -347,7 +389,7 @@ static int ...@@ -347,7 +389,7 @@ static int
347 opitr_first (void *owner) 389 opitr_first (void *owner)
348 { 390 {
349 struct opool_iterator *itr = owner; 391 struct opool_iterator *itr = owner;
350 itr->cur = itr->opool->head; 392 itr->cur = itr->opool->bkt_head;
351 return 0; 393 return 0;
352 } 394 }
353 395
...@@ -434,7 +476,7 @@ mu_opool_get_iterator (mu_opool_t opool, mu_iterator_t *piterator) ...@@ -434,7 +476,7 @@ mu_opool_get_iterator (mu_opool_t opool, mu_iterator_t *piterator)
434 if (!itr) 476 if (!itr)
435 return ENOMEM; 477 return ENOMEM;
436 itr->opool = opool; 478 itr->opool = opool;
437 itr->cur = opool->head; 479 itr->cur = opool->bkt_head;
438 480
439 status = mu_iterator_create (&iterator, itr); 481 status = mu_iterator_create (&iterator, itr);
440 if (status) 482 if (status)
......
...@@ -200,7 +200,7 @@ void ...@@ -200,7 +200,7 @@ void
200 _mu_line_begin () 200 _mu_line_begin ()
201 { 201 {
202 if (!pool) 202 if (!pool)
203 mu_opool_create (&pool, 1); 203 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
204 else 204 else
205 mu_opool_clear (pool); 205 mu_opool_clear (pool);
206 } 206 }
......
...@@ -1110,7 +1110,7 @@ mu_cfg_tree_create (struct mu_cfg_tree **ptree) ...@@ -1110,7 +1110,7 @@ mu_cfg_tree_create (struct mu_cfg_tree **ptree)
1110 struct mu_cfg_tree *tree = calloc (1, sizeof *tree); 1110 struct mu_cfg_tree *tree = calloc (1, sizeof *tree);
1111 if (!tree) 1111 if (!tree)
1112 return errno; 1112 return errno;
1113 mu_opool_create (&tree->pool, 1); 1113 mu_opool_create (&tree->pool, MU_OPOOL_ENOMEMABRT);
1114 *ptree = tree; 1114 *ptree = tree;
1115 return 0; 1115 return 0;
1116 } 1116 }
......
...@@ -111,7 +111,7 @@ mu_url_sget_name (const mu_url_t url, const char **retptr) ...@@ -111,7 +111,7 @@ mu_url_sget_name (const mu_url_t url, const char **retptr)
111 char *ptr, *newname; 111 char *ptr, *newname;
112 size_t size; 112 size_t size;
113 113
114 rc = mu_opool_create (&pool, 0); 114 rc = mu_opool_create (&pool, MU_OPOOL_DEFAULT);
115 if (rc) 115 if (rc)
116 return rc; 116 return rc;
117 rc = url_reconstruct_to_pool (url, pool); 117 rc = url_reconstruct_to_pool (url, pool);
......
...@@ -654,7 +654,7 @@ pop_header_blurb (mu_stream_t stream, size_t maxlines, ...@@ -654,7 +654,7 @@ pop_header_blurb (mu_stream_t stream, size_t maxlines,
654 size_t n; 654 size_t n;
655 size_t nlines = 0; 655 size_t nlines = 0;
656 656
657 status = mu_opool_create (&opool, 0); 657 status = mu_opool_create (&opool, MU_OPOOL_DEFAULT);
658 if (status) 658 if (status)
659 return status; 659 return status;
660 660
......
...@@ -678,7 +678,7 @@ main (int argc, char **argv) ...@@ -678,7 +678,7 @@ main (int argc, char **argv)
678 mu_attribute_set_deleted (attr); 678 mu_attribute_set_deleted (attr);
679 } 679 }
680 mu_mailbox_expunge (tmpbox); 680 mu_mailbox_expunge (tmpbox);
681 mu_opool_create (&pool, 1); 681 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
682 } 682 }
683 else 683 else
684 tmpbox = mbox; 684 tmpbox = mbox;
......
...@@ -499,7 +499,7 @@ mh_format_parse (char *format_str, mh_format_t *fmt) ...@@ -499,7 +499,7 @@ mh_format_parse (char *format_str, mh_format_t *fmt)
499 if (p) 499 if (p)
500 yydebug = 1; 500 yydebug = 1;
501 start = curp = format_str; 501 start = curp = format_str;
502 mu_opool_create (&tokpool, 1); 502 mu_opool_create (&tokpool, MU_OPOOL_ENOMEMABRT);
503 format.prog = NULL; 503 format.prog = NULL;
504 format.progsize = 0; 504 format.progsize = 0;
505 pc = 0; 505 pc = 0;
......
...@@ -490,7 +490,7 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t msgno, ...@@ -490,7 +490,7 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t msgno,
490 490
491 mach.width = width - 1; /* Count the newline */ 491 mach.width = width - 1; /* Count the newline */
492 mach.pc = 1; 492 mach.pc = 1;
493 mu_opool_create (&mach.pool, 1); 493 mu_opool_create (&mach.pool, MU_OPOOL_ENOMEMABRT);
494 mu_list_create (&mach.addrlist); 494 mu_list_create (&mach.addrlist);
495 495
496 reset_fmt_defaults (&mach); 496 reset_fmt_defaults (&mach);
......
...@@ -461,7 +461,7 @@ mhn_compose_command (char *typestr, char *typeargs, int *flags, char *file) ...@@ -461,7 +461,7 @@ mhn_compose_command (char *typestr, char *typeargs, int *flags, char *file)
461 %F %f, and stdout is not redirected 461 %F %f, and stdout is not redirected
462 %s subtype */ 462 %s subtype */
463 463
464 mu_opool_create (&pool, 1); 464 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
465 465
466 p = mu_str_skip_class (str, MU_CTYPE_SPACE); 466 p = mu_str_skip_class (str, MU_CTYPE_SPACE);
467 467
...@@ -642,7 +642,7 @@ mhn_show_command (mu_message_t msg, msg_part_t part, int *flags, ...@@ -642,7 +642,7 @@ mhn_show_command (mu_message_t msg, msg_part_t part, int *flags,
642 %s subtype 642 %s subtype
643 %d content description */ 643 %d content description */
644 644
645 mu_opool_create (&pool, 1); 645 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
646 646
647 p = mu_str_skip_class (str, MU_CTYPE_SPACE); 647 p = mu_str_skip_class (str, MU_CTYPE_SPACE);
648 648
...@@ -814,7 +814,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, const char *name, ...@@ -814,7 +814,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, const char *name,
814 %p part 814 %p part
815 %s subtype */ 815 %s subtype */
816 816
817 mu_opool_create (&pool, 1); 817 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
818 818
819 for (p = str; *p; p++) 819 for (p = str; *p; p++)
820 { 820 {
...@@ -1883,7 +1883,7 @@ parse_type_command (char **pcmd, struct compose_env *env, mu_header_t hdr) ...@@ -1883,7 +1883,7 @@ parse_type_command (char **pcmd, struct compose_env *env, mu_header_t hdr)
1883 return 1; 1883 return 1;
1884 } 1884 }
1885 1885
1886 mu_opool_create (&pool, 1); 1886 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
1887 1887
1888 mu_opool_appendz (pool, type); 1888 mu_opool_appendz (pool, type);
1889 mu_opool_append_char (pool, '/'); 1889 mu_opool_append_char (pool, '/');
...@@ -2050,7 +2050,7 @@ edit_extern (char *cmd, struct compose_env *env, mu_message_t *msg, int level) ...@@ -2050,7 +2050,7 @@ edit_extern (char *cmd, struct compose_env *env, mu_message_t *msg, int level)
2050 2050
2051 mu_message_get_header (*msg, &hdr); 2051 mu_message_get_header (*msg, &hdr);
2052 2052
2053 mu_opool_create (&pool, 1); 2053 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
2054 mu_opool_append (pool, EXTCONTENT, sizeof (EXTCONTENT) - 1); 2054 mu_opool_append (pool, EXTCONTENT, sizeof (EXTCONTENT) - 1);
2055 *--rest = ';'; /* FIXME */ 2055 *--rest = ';'; /* FIXME */
2056 rc = parse_content_type (env, pool, &rest, &id, NULL); 2056 rc = parse_content_type (env, pool, &rest, &id, NULL);
......
...@@ -156,7 +156,7 @@ main (int argc, char **argv) ...@@ -156,7 +156,7 @@ main (int argc, char **argv)
156 mu_opool_t opool; 156 mu_opool_t opool;
157 const char *prompt = name; 157 const char *prompt = name;
158 158
159 mu_opool_create (&opool, 1); 159 mu_opool_create (&opool, MU_OPOOL_ENOMEMABRT);
160 do 160 do
161 { 161 {
162 size_t len; 162 size_t len;
......
...@@ -73,7 +73,7 @@ set_fcc (struct mu_parseopt *po, struct mu_option *opt, char const *arg) ...@@ -73,7 +73,7 @@ set_fcc (struct mu_parseopt *po, struct mu_option *opt, char const *arg)
73 { 73 {
74 if (!has_fcc) 74 if (!has_fcc)
75 { 75 {
76 mu_opool_create (&fcc_pool, 1); 76 mu_opool_create (&fcc_pool, MU_OPOOL_ENOMEMABRT);
77 has_fcc = 1; 77 has_fcc = 1;
78 } 78 }
79 else 79 else
......
...@@ -84,7 +84,7 @@ mh_whatnow_env_to_environ (struct mh_whatnow_env *wh) ...@@ -84,7 +84,7 @@ mh_whatnow_env_to_environ (struct mh_whatnow_env *wh)
84 int mrange = 0; 84 int mrange = 0;
85 const char *s; 85 const char *s;
86 86
87 mu_opool_create (&opool, 1); 87 mu_opool_create (&opool, MU_OPOOL_ENOMEMABRT);
88 mu_list_get_iterator (wh->anno_list, &itr); 88 mu_list_get_iterator (wh->anno_list, &itr);
89 for (mu_iterator_first (itr); !mu_iterator_is_done (itr); 89 for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
90 mu_iterator_next (itr)) 90 mu_iterator_next (itr))
......
...@@ -172,7 +172,7 @@ mimetypes_open (const char *name) ...@@ -172,7 +172,7 @@ mimetypes_open (const char *name)
172 return -1; 172 return -1;
173 } 173 }
174 line_num = 1; 174 line_num = 1;
175 mu_opool_create (&pool, 1); 175 mu_opool_create (&pool, MU_OPOOL_ENOMEMABRT);
176 return 0; 176 return 0;
177 } 177 }
178 178
......
...@@ -610,7 +610,7 @@ newfmt_init (struct xfer_format *fmt, const char *version, ...@@ -610,7 +610,7 @@ newfmt_init (struct xfer_format *fmt, const char *version,
610 else 610 else
611 { 611 {
612 mu_opool_t pool; 612 mu_opool_t pool;
613 rc = mu_opool_create (&pool, 0); 613 rc = mu_opool_create (&pool, MU_OPOOL_DEFAULT);
614 if (rc) 614 if (rc)
615 { 615 {
616 mu_diag_funcall (MU_DIAG_ERROR, "mu_opool_create", 616 mu_diag_funcall (MU_DIAG_ERROR, "mu_opool_create",
......