summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/util.c b/util.c
index 1b363cd..21921e8 100644
--- a/util.c
+++ b/util.c
@@ -263,15 +263,14 @@ static int xrpregex(nl_item item, const char *response) {
return -1;
}
- int err;
- struct bfs_regex *regex = bfs_regcomp(pattern, BFS_REGEX_POSIX_EXTENDED, 0, &err);
- if (!regex) {
- return -1;
+ struct bfs_regex *regex;
+ int ret = bfs_regcomp(&regex, pattern, BFS_REGEX_POSIX_EXTENDED, 0);
+ if (ret == 0) {
+ ret = bfs_regexec(regex, response, 0);
}
- int ret = bfs_regexec(regex, response, 0, &err);
bfs_regfree(regex);
- return err ? -1 : ret;
+ return ret;
}
/** Check if a response is affirmative or negative. */