summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2018-05-22 16:51:07 -0400
committerChet Ramey <chet.ramey@case.edu>2018-05-22 16:51:07 -0400
commit9a51695bed07d37086c352372ac69d0a30039a6b (patch)
tree4d0f57cba0dd1ec7a75aae56e18cfe9997d0b7a7 /include
parent7de27456f6494f5f9c11ea1c19024d0024f31112 (diff)
downloadbash-9a51695bed07d37086c352372ac69d0a30039a6b.tar.gz
bash-5.0-alpha releasebash-5.0-alpha
Diffstat (limited to 'include')
-rw-r--r--include/shmbutil.h5
-rw-r--r--include/stdc.h10
-rw-r--r--include/typemax.h17
3 files changed, 28 insertions, 4 deletions
diff --git a/include/shmbutil.h b/include/shmbutil.h
index dbaaba86..264cae33 100644
--- a/include/shmbutil.h
+++ b/include/shmbutil.h
@@ -37,6 +37,7 @@ extern size_t mbstrlen __P((const char *));
extern char *xstrchr __P((const char *, int));
extern int locale_mb_cur_max; /* XXX */
+extern int locale_utf8locale; /* XXX */
#ifndef MB_INVALIDCH
#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
@@ -109,6 +110,8 @@ extern int locale_mb_cur_max; /* XXX */
_f = is_basic ((_str)[_i]); \
if (_f) \
mblength = 1; \
+ else if (locale_utf8locale && (((_str)[_i] & 0x80) == 0)) \
+ mblength = 1; \
else \
{ \
state_bak = state; \
@@ -267,6 +270,8 @@ extern int locale_mb_cur_max; /* XXX */
_k = is_basic (*(_src)); \
if (_k) \
mblength = 1; \
+ else if (locale_utf8locale && ((*(_src) & 0x80) == 0)) \
+ mblength = 1; \
else \
{ \
state_bak = state; \
diff --git a/include/stdc.h b/include/stdc.h
index d2fd4b25..c66492f0 100644
--- a/include/stdc.h
+++ b/include/stdc.h
@@ -36,6 +36,16 @@
# endif
#endif
+/* New definition to use, moving away from __P since it's part of a reserved
+ namespace */
+#if !defined (PARAMS)
+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES)
+# define PARAMS(protos) protos
+# else
+# define PARAMS(protos) ()
+# endif
+#endif
+
/* Fortify, at least, has trouble with this definition */
#if defined (HAVE_STRINGIZE)
# define CPP_STRING(x) #x
diff --git a/include/typemax.h b/include/typemax.h
index aa21c9c6..0f696388 100644
--- a/include/typemax.h
+++ b/include/typemax.h
@@ -35,14 +35,23 @@
# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
#endif
+#ifndef TYPE_SIGNED_MAGNITUDE
+# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+#endif
+
+#ifndef TYPE_WIDTH
+# define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
+#endif
+
#ifndef TYPE_MINIMUM
-# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
- : (t) 0))
+# define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
#endif
#ifndef TYPE_MAXIMUM
-# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+# define TYPE_MAXIMUM(t) \
+ ((t) (! TYPE_SIGNED (t) \
+ ? (t) -1 \
+ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
#endif
#ifdef HAVE_LONG_LONG