X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fcommon%2Fdoregex.c;fp=src%2Fcommon%2Fdoregex.c;h=f4242db3803d40d8898a7e7e3099c8b4acd031a1;hb=a2a3817b086e939c552359e42b75e11c90ff4a40;hp=8ad9b3918ed0e6d4c106304ee382ee5d10083132;hpb=26a80cc0cae35a63247b69a262aacd2a3932d924;p=tpg%2Fopendispense2.git 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];