summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-06 15:32:20 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-12-06 15:47:19 +0200
commitdf608ed0cfb5f0db57d1ff97eb208ceb46f06e17 (patch)
tree87536d81395c41d8720dd846d18665108559773d /include
parentf8a0fd0fdb20fdb607343d932f19e650dfd8f1d2 (diff)
downloadmailutils-df608ed0cfb5f0db57d1ff97eb208ceb46f06e17.tar.gz
mailutils-df608ed0cfb5f0db57d1ff97eb208ceb46f06e17.tar.bz2
New API for converting globbing patterns to extended POSIX regex
* include/mailutils/opool.h (mu_nonlocal_jmp_t): New type. (mu_opool_setjmp,mu_opool_clrjmp): New functions. (mu_opool_setup_nonlocal_jump): New macro. * libmailutils/base/opool.c (_mu_opool)<jmp>: New field. (alloc_bucket): Do a non-local jump on out of memory condition, if jmp is not NULL. (mu_opool_setjmp,mu_opool_clrjmp): New functions. * libmailutils/base/glob.c: New file. * libmailutils/base/Makefile.am: Add glob.c * include/mailutils/glob.h: New file. * include/mailutils/mailutils.h: Include glob.h * libmailutils/tests/globtest.c: New file. * libmailutils/tests/globtest.at: New test. * libmailutils/tests/Makefile.am: Add new files. * libmailutils/tests/testsuite.at: Include new test.
Diffstat (limited to 'include')
-rw-r--r--include/mailutils/mailutils.h1
-rw-r--r--include/mailutils/opool.h22
2 files changed, 23 insertions, 0 deletions
diff --git a/include/mailutils/mailutils.h b/include/mailutils/mailutils.h
index cc14889fb..dfcb3573b 100644
--- a/include/mailutils/mailutils.h
+++ b/include/mailutils/mailutils.h
@@ -32,6 +32,7 @@
#include <mailutils/error.h>
#include <mailutils/filter.h>
#include <mailutils/folder.h>
+#include <mailutils/glob.h>
#include <mailutils/header.h>
#include <mailutils/iterator.h>
#include <mailutils/kwd.h>
diff --git a/include/mailutils/opool.h b/include/mailutils/opool.h
index 45fe64f8f..9f474cf31 100644
--- a/include/mailutils/opool.h
+++ b/include/mailutils/opool.h
@@ -19,6 +19,7 @@
#define _MAILUTILS_OPOOL_H
#include <mailutils/types.h>
+#include <setjmp.h>
#ifndef MU_OPOOL_BUCKET_SIZE
# define MU_OPOOL_BUCKET_SIZE 1024
@@ -33,6 +34,27 @@ int mu_opool_create (mu_opool_t *pret, int flags);
int mu_opool_set_bucket_size (mu_opool_t opool, size_t size);
int mu_opool_get_bucket_size (mu_opool_t opool, size_t *psize);
+struct mu_nonlocal_jmp
+{
+ jmp_buf buf;
+ struct mu_nonlocal_jmp *next;
+};
+
+typedef struct mu_nonlocal_jmp mu_nonlocal_jmp_t;
+
+void mu_opool_setjmp (mu_opool_t opool, mu_nonlocal_jmp_t *err);
+void mu_opool_clrjmp (mu_opool_t opool);
+
+#define mu_opool_setup_nonlocal_jump(p,jb) \
+ do \
+ { \
+ int __rc = setjmp (jb.buf); \
+ if (__rc) \
+ return __rc; \
+ mu_opool_setjmp (p, &jb); \
+ } \
+ while (0)
+
/* Merge all data from *SRC into *DST. If the latter is NULL, create
it. On success, free *SRC and initialize it with NULL. */
int mu_opool_union (mu_opool_t *dst, mu_opool_t *src);

Return to:

Send suggestions and report system problems to the System administrator.