Skip to content

Commit

Permalink
regexec.c: simplify re_search_2_stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Eggert authored and Ulrich Drepper committed Jan 22, 2010
1 parent 5ddf954 commit d044d84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2010-01-22 Jim Meyering <jim@meyering.net>

[BZ #11187]
* posix/regexec.c (re_search_2_stub): Use simpler method than
boolean for freeing internal storage.

2010-01-22 Ulrich Drepper <drepper@redhat.com>

* posix/regex_internal.c (re_string_skip_chars): Simplify test for
Expand Down
11 changes: 4 additions & 7 deletions posix/regexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
const char *str;
int rval;
int len = length1 + length2;
int free_str = 0;
char *s = NULL;

if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
return -2;
Expand All @@ -377,7 +377,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
if (length2 > 0)
if (length1 > 0)
{
char *s = re_malloc (char, len);
s = re_malloc (char, len);

if (BE (s == NULL, 0))
return -2;
Expand All @@ -388,17 +388,14 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
memcpy (s + length1, string2, length2);
#endif
str = s;
free_str = 1;
}
else
str = string2;
else
str = string1;

rval = re_search_stub (bufp, str, len, start, range, stop, regs,
ret_len);
if (free_str)
re_free ((char *) str);
rval = re_search_stub (bufp, str, len, start, range, stop, regs, ret_len);
re_free (s);
return rval;
}

Expand Down

0 comments on commit d044d84

Please sign in to comment.