From: Mark Tearle Date: Sat, 27 Dec 2014 12:34:32 +0000 (+0800) Subject: Tidy up initialisation in doregex.c X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a2a3817b086e939c552359e42b75e11c90ff4a40;p=tpg%2Fopendispense2.git Tidy up initialisation in doregex.c --- 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];