summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-07-05 17:51:31 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-07-05 18:59:31 -0700
commitd6662694d05be03fdd070353637dd22a324c8b7a (patch)
tree3823cc192290478c041db63121c88afebfccbc13 /src/regex.c
parent24faf6b0d2fe990e9334dd2e3238f749fec87897 (diff)
downloademacs-d6662694d05be03fdd070353637dd22a324c8b7a.tar.gz
Convert hex digits more systematically
This makes the code a bit smaller and presumably faster, as it substitutes a single lookup for conditional jumps. * src/character.c (hexdigit): New constant. (syms_of_character) [HEXDIGIT_IS_CONST]: Initialize it. * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): New macros. (hexdigit): New decl. (char_hexdigit): New inline function. * src/charset.c: Do not include c-ctype.h. * src/charset.c (read_hex): * src/editfns.c (styled_format): * src/image.c (xbm_scan): * src/lread.c (read_escape): * src/regex.c (ISXDIGIT) [emacs]: Use char_hexdigit insted of doing it by hand.
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/regex.c b/src/regex.c
index 240a91f2ba8..fb48765c96c 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -306,9 +306,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
/* In Emacs, these are only used for single-byte characters. */
# define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
# define ISCNTRL(c) ((c) < ' ')
-# define ISXDIGIT(c) (((c) >= '0' && (c) <= '9') \
- || ((c) >= 'a' && (c) <= 'f') \
- || ((c) >= 'A' && (c) <= 'F'))
+# define ISXDIGIT(c) (0 <= char_hexdigit (c))
/* The rest must handle multibyte characters. */