summaryrefslogtreecommitdiff
path: root/src/character.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-11-15 01:28:33 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-11-15 01:29:52 -0800
commite68912ea6be6338f3ca659cb01ec2bd616e8e660 (patch)
tree2470eb062276645228c38814da639313c9630c7f /src/character.h
parent0114bb964afd81b6a6dc8c742bceba61d0f2a7dc (diff)
downloademacs-e68912ea6be6338f3ca659cb01ec2bd616e8e660.tar.gz
Port hexdigit init to non-GCC + pdumper
The old code assumed that hexdigit initialization (needed by non-GCC) could be done in syms_of_character, but that is no longer true with pdumper. Instead, simplify hexdigit init so that it can be done statically on all C99 platforms. Problem discovered on Solaris 10 sparc + Oracle Solaris Studio 12.6. * src/character.c (hexdigit): Add 1 to every value; all uses changed. This simplifies the initialization so that it can be done statically on any C99 compiler. hexdigit is now always const. (syms_of_character): Omit no-longer-necessary initialization. * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): Remove. All uses removed.
Diffstat (limited to 'src/character.h')
-rw-r--r--src/character.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/character.h b/src/character.h
index cc57a2a7d5c..230fc6eab59 100644
--- a/src/character.h
+++ b/src/character.h
@@ -704,14 +704,7 @@ char_table_translate (Lisp_Object obj, int ch)
return CHARACTERP (obj) ? XFIXNUM (obj) : ch;
}
-#if defined __GNUC__ && !defined __STRICT_ANSI__
-# define HEXDIGIT_CONST const
-# define HEXDIGIT_IS_CONST true
-#else
-# define HEXDIGIT_CONST
-# define HEXDIGIT_IS_CONST false
-#endif
-extern signed char HEXDIGIT_CONST hexdigit[];
+extern signed char const hexdigit[];
/* If C is a hexadecimal digit ('0'-'9', 'a'-'f', 'A'-'F'), return its
value (0-15). Otherwise return -1. */
@@ -719,7 +712,7 @@ extern signed char HEXDIGIT_CONST hexdigit[];
INLINE int
char_hexdigit (int c)
{
- return 0 <= c && c <= UCHAR_MAX ? hexdigit[c] : -1;
+ return 0 <= c && c <= UCHAR_MAX ? hexdigit[c] - 1 : -1;
}
INLINE_HEADER_END