* [PATCH] Sync regfree with old regex
@ 2004-01-05 21:49 Jakub Jelinek
2004-01-06 22:02 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-01-05 21:49 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Sync regfree with old regex
2004-01-05 21:49 [PATCH] Sync regfree with old regex Jakub Jelinek
@ 2004-01-06 22:02 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-01-06 22:02 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've applied the two regex patches. Thanks,
- --
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/+y/a2ijCOnn/RHQRAuMQAJ9Z1af2JJkKcn7NcyeI4Bx1oNanjACeOiqv
gSsaJ6pmRmICrg809l+UxsU=
=mQoN
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-06 22:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-05 21:49 [PATCH] Sync regfree with old regex Jakub Jelinek
2004-01-06 22:02 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).