aboutsummaryrefslogtreecommitdiff
path: root/notmuch-restore.c
diff options
context:
space:
mode:
authorDavid Bremner <bremner@debian.org>2011-10-23 17:52:19 -0300
committerDavid Bremner <bremner@debian.org>2011-10-30 23:10:38 -0300
commit7a87830f5eb32373bc17235e9d178d383830dc64 (patch)
treecbdfb839d39797ea4a87292fffe2b01a08f053f2 /notmuch-restore.c
parent1dedfc90f6eee7cad10f1a1ceb39a7a1c4dbd1b1 (diff)
xregcomp: don't consider every regex compilation failure an internal error.
This pushes the error handling up one step, but makes the function more flexible. Running out of memory still triggers an internal error, in the spirit of other xutils functions.
Diffstat (limited to 'notmuch-restore.c')
-rw-r--r--notmuch-restore.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/notmuch-restore.c b/notmuch-restore.c
index ff1ebab..13b4325 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -88,9 +88,10 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
* non-space characters for the message-id, then one or more
* spaces, then a list of space-separated tags as a sequence of
* characters within literal '(' and ')'. */
- xregcomp (&regex,
- "^([^ ]+) \\(([^)]*)\\)$",
- REG_EXTENDED);
+ if ( xregcomp (&regex,
+ "^([^ ]+) \\(([^)]*)\\)$",
+ REG_EXTENDED) )
+ INTERNAL_ERROR("compile time constant regex failed.");
while ((line_len = getline (&line, &line_size, input)) != -1) {
regmatch_t match[3];