Imported Upstream version 2.6.0
This commit is contained in:
parent
26fb71b504
commit
459aaf9392
510 changed files with 40508 additions and 18859 deletions
|
|
@ -210,7 +210,7 @@ static int compile_regex(regex_t **compiled, char *regex, int cflags)
|
|||
static int match_regex(regex_t *preg, char *str)
|
||||
{
|
||||
int r;
|
||||
size_t len;
|
||||
size_t len = 0;
|
||||
char *string;
|
||||
regmatch_t match;
|
||||
|
||||
|
|
@ -219,31 +219,28 @@ static int match_regex(regex_t *preg, char *str)
|
|||
}
|
||||
|
||||
if (!str) {
|
||||
str = "";
|
||||
}
|
||||
string = xstrdup("");
|
||||
} else {
|
||||
/* skip leading whitespace */
|
||||
for (len = 0; len < strlen(str); len++) {
|
||||
|
||||
/* skip leading whitespace */
|
||||
for (len = 0; len < strlen(str); len++) {
|
||||
|
||||
if (!strchr(" \t\n", str[len])) {
|
||||
break;
|
||||
if (!strchr(" \t\n", str[len])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string = strdup(str+len);
|
||||
if (!string) {
|
||||
return -1;
|
||||
}
|
||||
string = xstrdup(str+len);
|
||||
|
||||
/* skip trailing whitespace */
|
||||
for (len = strlen(string); len > 0; len--) {
|
||||
/* skip trailing whitespace */
|
||||
for (len = strlen(string); len > 0; len--) {
|
||||
|
||||
if (!strchr(" \t\n", string[len-1])) {
|
||||
break;
|
||||
if (!strchr(" \t\n", string[len-1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string[len] = '\0';
|
||||
string[len] = '\0';
|
||||
}
|
||||
|
||||
/* test the regular expression */
|
||||
r = regexec(preg, string, 1, &match, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue