Replace all exit() with SWIG_exit()

For consistent cleanup on error
This commit is contained in:
William S Fulton 2019-07-29 19:35:54 +01:00
commit 2cf075558c
11 changed files with 24 additions and 24 deletions

View file

@ -1177,7 +1177,7 @@ String *Swig_string_command(String *s) {
pclose(fp);
} else {
Swig_error("SWIG", Getline(s), "Command encoder fails attempting '%s'.\n", s);
exit(1);
SWIG_exit(EXIT_FAILURE);
}
}
#endif
@ -1327,7 +1327,8 @@ static int split_regex_pattern_subst(String *s, String **pattern, String **subst
err_out:
Swig_error("SWIG", Getline(s), "Invalid regex substitution: '%s'.\n", s);
exit(1);
SWIG_exit(EXIT_FAILURE);
return 0;
}
/* This function copies len characters from src to dst, possibly applying case conversions to them: if convertCase is 1, to upper case and if it is -1, to lower
@ -1449,7 +1450,7 @@ String *Swig_string_regex(String *s) {
if (!compiled_pat) {
Swig_error("SWIG", Getline(s), "PCRE compilation failed: '%s' in '%s':%i.\n",
pcre_error, Char(pattern), pcre_errorpos);
exit(1);
SWIG_exit(EXIT_FAILURE);
}
rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
if (rc >= 0) {
@ -1457,7 +1458,7 @@ String *Swig_string_regex(String *s) {
} else if (rc != PCRE_ERROR_NOMATCH) {
Swig_error("SWIG", Getline(s), "PCRE execution failed: error %d while matching \"%s\" using \"%s\".\n",
rc, Char(pattern), input);
exit(1);
SWIG_exit(EXIT_FAILURE);
}
}
@ -1475,7 +1476,8 @@ String *Swig_pcre_version(void) {
String *Swig_string_regex(String *s) {
Swig_error("SWIG", Getline(s), "PCRE regex support not enabled in this SWIG build.\n");
exit(1);
SWIG_exit(EXIT_FAILURE);
return 0;
}
String *Swig_pcre_version(void) {