diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-10-25 23:06:18 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-10-25 23:07:00 +0100 |
commit | e39606c411bad57de5891965628f6ac278df42ee (patch) | |
tree | 697c5404c0a9bbe616bada833db7bb52df9bd778 /utils/utils.c | |
parent | df89f689f7ddcb082b4616c6e32cabbb859b3a11 (diff) | |
download | netsurf-e39606c411bad57de5891965628f6ac278df42ee.tar.gz netsurf-e39606c411bad57de5891965628f6ac278df42ee.tar.bz2 |
make regex wrapper return errors instead of just aborting
Diffstat (limited to 'utils/utils.c')
-rw-r--r-- | utils/utils.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/utils.c b/utils/utils.c index 6199a8451..6730c9fa1 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -33,6 +33,7 @@ #include <time.h> #include "utils/config.h" +#include "utils/log.h" #include "utils/messages.h" #include "utils/utf8.h" #include "utils/time.h" @@ -207,18 +208,20 @@ nserror snstrjoin(char **str, size_t *size, char sep, size_t nelm, ...) /* exported interface documented in utils/utils.h */ -void regcomp_wrapper(regex_t *preg, const char *regex, int cflags) +nserror regcomp_wrapper(regex_t *preg, const char *regex, int cflags) { int r; r = regcomp(preg, regex, cflags); if (r) { char errbuf[200]; regerror(r, preg, errbuf, sizeof errbuf); - fprintf(stderr, "Failed to compile regexp '%s'\n", regex); - die(errbuf); + LOG(("Failed to compile regexp '%s': %s\n", regex, errbuf)); + return NSERROR_INIT_FAILED; } + return NSERROR_OK; } + /** * The size of buffers within human_friendly_bytesize. * |