This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! Old regex was freeing preg->translate in regfree as well as clearing the fields so that the re_pattern_buffer can be immediately reused by another re_compile_pattern. This patch should make zero difference for the POSIX interface (regcomp initializes all those 4 fields and never sets preg->translate) and should bring regfree behaviour after re_compile_pattern to how it used to work (given the lack of good enough specification for the re_* API I think the old regex should be the ultimate specification). 2004-01-05 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c (regcomp): Fix comment typo. (regfree): Free preg->translate, clear buffer, allocated, fastmap and translate fields. --- libc/posix/regcomp.c.jj 2004-01-05 12:53:47.000000000 +0100 +++ libc/posix/regcomp.c 2004-01-05 21:37:17.000000000 +0100 @@ -503,7 +503,7 @@ regcomp (preg, pattern, cflags) /* We have already checked preg->fastmap != NULL. */ if (BE (ret == REG_NOERROR, 1)) /* Compute the fastmap now, since regexec cannot modify the pattern - buffer. This function nevers fails in this implementation. */ + buffer. This function never fails in this implementation. */ (void) re_compile_fastmap (preg); else { @@ -632,8 +632,14 @@ regfree (preg) re_dfa_t *dfa = (re_dfa_t *) preg->buffer; if (BE (dfa != NULL, 1)) free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; re_free (preg->fastmap); + preg->fastmap = NULL; + + re_free (preg->translate); + preg->translate = NULL; } #ifdef _LIBC weak_alias (__regfree, regfree) Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |