GNU bug report logs -
#23712
[PATCH 1/6] maint: mark a couple of static variables const
Previous Next
Reported by: Zev Weiss <zev <at> bewilderbeest.net>
Date: Tue, 7 Jun 2016 06:39:02 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23712 in the body.
You can then email your comments to 23712 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-grep <at> gnu.org
:
bug#23712
; Package
grep
.
(Tue, 07 Jun 2016 06:39:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Zev Weiss <zev <at> bewilderbeest.net>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Tue, 07 Jun 2016 06:39:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* src/dfa.c (parse_bracket_exp): mark zeroclass const.
* src/dfasearch.c: mark patterns0 const.
---
src/dfa.c | 2 +-
src/dfasearch.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index 4e47b39..19363ce 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -1183,7 +1183,7 @@ parse_bracket_exp (void)
if (dfa->multibyte)
{
- static charclass zeroclass;
+ static charclass const zeroclass;
work_mbc->invert = invert;
work_mbc->cset = equal (ccl, zeroclass) ? -1 : charclass_index (ccl);
return MBCSET;
diff --git a/src/dfasearch.c b/src/dfasearch.c
index d3db824..8052ef0 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -38,7 +38,7 @@ static kwset_t kwset;
static struct dfa *dfa;
/* The Regex compiled patterns. */
-static struct patterns
+static const struct patterns
{
/* Regex compiled regexp. */
struct re_pattern_buffer regexbuf;
--
2.8.0.rc3
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Thu, 18 Aug 2016 01:55:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Zev Weiss <zev <at> bewilderbeest.net>
:
bug acknowledged by developer.
(Thu, 18 Aug 2016 01:55:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 23712-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks, this patch was installed into grep in June so I'm marking the bug report
as done.
Also, I installed the attached two patches as followup. The first is because
I've run into too many compilers that complain about 'static const int x;' on
the grounds that x should have an initializer. Rewriting the code to avoid these
zero constants makes the code a tiny bit smaller on x86-64, so it's likely a
tiny win anyway.
The 2nd patch changes this code to use 64-bit words on x86-64 GNU/Linux, much as
other parts of grep already do. This makes the code a tiny bit smaller too.
The runtime performance change is likely so small I haven't bothered to try to
measure it. Perhaps some day compilers will be smart enough to put those 256-bit
arrays into registers and regex nerds can tune it some more....
[0001-dfa-avoid-uninitialized-constants.patch (text/x-diff, attachment)]
[0002-dfa-use-64-bit-when-ulong-is-at-least-that-wide.patch (text/x-diff, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 15 Sep 2016 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 342 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.