This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4f3d592
)
regcomp.c: Change lookup for dumping pattern
author
Karl Williamson
<khw@cpan.org>
Mon, 30 Jan 2017 21:01:29 +0000
(14:01 -0700)
committer
Karl Williamson
<khw@cpan.org>
Thu, 1 Jun 2017 12:33:17 +0000
(06:33 -0600)
Instead of using a bunch of branches, use strchr() to see if a
character is a member of a class. This is a common paradigm in the
parsers.
regcomp.c
patch
|
blob
|
blame
|
history
diff --git
a/regcomp.c
b/regcomp.c
index
54d641d
..
f9d56c1
100644
(file)
--- a/
regcomp.c
+++ b/
regcomp.c
@@
-119,8
+119,7
@@
typedef struct scan_frame {
/* Certain characters are output as a sequence with the first being a
* backslash. */
-#define isBACKSLASHED_PUNCT(c) \
- ((c) == '-' || (c) == ']' || (c) == '\\' || (c) == '^')
+#define isBACKSLASHED_PUNCT(c) strchr("-]\\^", c)
struct RExC_state_t {