Replaced some large local variables by other means in xorriso/misc_funct.c

This commit is contained in:
Thomas Schmitt 2011-05-05 08:14:09 +00:00
parent bda4601bd1
commit 165c82c394
2 changed files with 14 additions and 6 deletions

View File

@ -980,23 +980,31 @@ int Sregex_resolve_var(char *form, char *vars[][2], int num_vars,
int Sregex_match(char *pattern, char *text, int flag) int Sregex_match(char *pattern, char *text, int flag)
{ {
int ret; int ret;
char re_text[2*SfileadrL]; char *re_text= NULL;
regex_t re; regex_t re;
regmatch_t match[1]; regmatch_t match[1];
re_text= TSOB_FELD(char, 2 * SfileadrL);
if(re_text == NULL)
{ret= -1; goto ex;}
Xorriso__bourne_to_reg(pattern, re_text, 0); Xorriso__bourne_to_reg(pattern, re_text, 0);
ret= regcomp(&re, re_text, 0); ret= regcomp(&re, re_text, 0);
if(ret != 0) if(ret != 0)
return(-1); {ret= -1; goto ex;}
if(flag & 1) { if(flag & 1) {
regfree(&re); regfree(&re);
return(1); {ret= 1; goto ex;}
} }
ret= regexec(&re, text, 1, match, 0); ret= regexec(&re, text, 1, match, 0);
regfree(&re); regfree(&re);
if(ret != 0) if(ret != 0)
return(0); goto ex;
return(1); ret= 1;
ex:;
if(re_text != NULL)
free(re_text);
return(ret);
} }

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.05.05.075233" #define Xorriso_timestamP "2011.05.05.081436"