From a2a3817b086e939c552359e42b75e11c90ff4a40 Mon Sep 17 00:00:00 2001 From: Mark Tearle Date: Sat, 27 Dec 2014 20:34:32 +0800 Subject: [PATCH] Tidy up initialisation in doregex.c --- src/common/doregex.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/doregex.c b/src/common/doregex.c index 8ad9b39..f4242db 100644 --- a/src/common/doregex.c +++ b/src/common/doregex.c @@ -14,7 +14,7 @@ // === CODE === int RunRegex(regex_t *regex, const char *string, int nMatches, regmatch_t *matches, const char *errorMessage) { - int ret; + int ret = -1; ret = regexec(regex, string, nMatches, matches, 0); if( ret == REG_NOMATCH ) { @@ -34,7 +34,9 @@ int RunRegex(regex_t *regex, const char *string, int nMatches, regmatch_t *match void CompileRegex(regex_t *regex, const char *pattern, int flags) { - int ret = regcomp(regex, pattern, flags); + int ret = -1; + + ret = regcomp(regex, pattern, flags); if( ret ) { size_t len = regerror(ret, regex, NULL, 0); char errorStr[len]; -- 2.20.1