Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-09 03:28:16 +0300
committerMike Frysinger <vapier@gentoo.org>2021-11-12 01:26:45 +0300
commit3ba1bd0d9dbc015c14a0aaafcef042f706d1249a (patch)
treec90b5c4068f561c81c61dc418f697c4332093bc7 /newlib/libc/ctype
parent88c9008bb2a7377722968d3ec738ac44ceea8665 (diff)
ctype: use less short names in public header
We're seeing a build failure in GNU sim code which is using _P locally but the ctype.h define clashes with it. Rename these to use the same symbols that glibc does. They're a bit more verbose, but seems likely that we'll have fewer conflicts if glibc isn't seeing them. However, these shortnames are still used internally by ctype modules to produce pretty concise source code, so move the short names to the internal ctype_.h where short name conflicts shouldn't show up.
Diffstat (limited to 'newlib/libc/ctype')
-rw-r--r--newlib/libc/ctype/ctype_.h10
-rw-r--r--newlib/libc/ctype/isalnum.c2
-rw-r--r--newlib/libc/ctype/isalnum_l.c2
-rw-r--r--newlib/libc/ctype/isalpha.c2
-rw-r--r--newlib/libc/ctype/isalpha_l.c2
-rw-r--r--newlib/libc/ctype/isblank.c2
-rw-r--r--newlib/libc/ctype/isblank_l.c2
-rw-r--r--newlib/libc/ctype/iscntrl.c2
-rw-r--r--newlib/libc/ctype/iscntrl_l.c2
-rw-r--r--newlib/libc/ctype/isdigit.c2
-rw-r--r--newlib/libc/ctype/isdigit_l.c2
-rw-r--r--newlib/libc/ctype/islower.c2
-rw-r--r--newlib/libc/ctype/islower_l.c2
-rw-r--r--newlib/libc/ctype/isprint.c4
-rw-r--r--newlib/libc/ctype/isprint_l.c4
-rw-r--r--newlib/libc/ctype/ispunct.c2
-rw-r--r--newlib/libc/ctype/ispunct_l.c2
-rw-r--r--newlib/libc/ctype/isspace.c2
-rw-r--r--newlib/libc/ctype/isspace_l.c2
-rw-r--r--newlib/libc/ctype/isupper.c2
-rw-r--r--newlib/libc/ctype/isupper_l.c2
-rw-r--r--newlib/libc/ctype/isxdigit.c2
-rw-r--r--newlib/libc/ctype/isxdigit_l.c2
23 files changed, 34 insertions, 24 deletions
diff --git a/newlib/libc/ctype/ctype_.h b/newlib/libc/ctype/ctype_.h
index a73870b3e..42ad2c870 100644
--- a/newlib/libc/ctype/ctype_.h
+++ b/newlib/libc/ctype/ctype_.h
@@ -1,5 +1,15 @@
#include <ctype.h>
+/* Define some short names to keep internal files shorter. */
+#define _U _ISupper
+#define _L _ISlower
+#define _N _ISdigit
+#define _S _ISspace
+#define _P _ISpunct
+#define _C _IScntrl
+#define _X _ISxdigit
+#define _B _ISblank
+
#if (defined(__GNUC__) && !defined(__CHAR_UNSIGNED__) && !defined(COMPACT_CTYPE)) || defined (__CYGWIN__)
#define ALLOW_NEGATIVE_CTYPE_INDEX
#endif
diff --git a/newlib/libc/ctype/isalnum.c b/newlib/libc/ctype/isalnum.c
index d926f97b7..3ddf0d2e1 100644
--- a/newlib/libc/ctype/isalnum.c
+++ b/newlib/libc/ctype/isalnum.c
@@ -46,5 +46,5 @@ No OS subroutines are required.
int
isalnum (int c)
{
- return(__CTYPE_PTR[c+1] & (_U|_L|_N));
+ return(__CTYPE_PTR[c+1] & (_ISupper|_ISlower|_ISdigit));
}
diff --git a/newlib/libc/ctype/isalnum_l.c b/newlib/libc/ctype/isalnum_l.c
index dcb7e3652..e3587f1b2 100644
--- a/newlib/libc/ctype/isalnum_l.c
+++ b/newlib/libc/ctype/isalnum_l.c
@@ -6,5 +6,5 @@
int
isalnum_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & (_U|_L|_N);
+ return __locale_ctype_ptr_l (locale)[c+1] & (_ISupper|_ISlower|_ISdigit);
}
diff --git a/newlib/libc/ctype/isalpha.c b/newlib/libc/ctype/isalpha.c
index 8b8e78a29..c8de62cea 100644
--- a/newlib/libc/ctype/isalpha.c
+++ b/newlib/libc/ctype/isalpha.c
@@ -45,5 +45,5 @@ No supporting OS subroutines are required.
int
isalpha (int c)
{
- return(__CTYPE_PTR[c+1] & (_U|_L));
+ return(__CTYPE_PTR[c+1] & (_ISupper|_ISlower));
}
diff --git a/newlib/libc/ctype/isalpha_l.c b/newlib/libc/ctype/isalpha_l.c
index dcae3ccb4..6ff1e3b68 100644
--- a/newlib/libc/ctype/isalpha_l.c
+++ b/newlib/libc/ctype/isalpha_l.c
@@ -6,5 +6,5 @@
int
isalpha_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & (_U|_L);
+ return __locale_ctype_ptr_l (locale)[c+1] & (_ISupper|_ISlower);
}
diff --git a/newlib/libc/ctype/isblank.c b/newlib/libc/ctype/isblank.c
index 0ebc2192c..2fa29f33f 100644
--- a/newlib/libc/ctype/isblank.c
+++ b/newlib/libc/ctype/isblank.c
@@ -44,5 +44,5 @@ No supporting OS subroutines are required.
int
isblank (int c)
{
- return ((__CTYPE_PTR[c+1] & _B) || (c == '\t'));
+ return ((__CTYPE_PTR[c+1] & _ISblank) || (c == '\t'));
}
diff --git a/newlib/libc/ctype/isblank_l.c b/newlib/libc/ctype/isblank_l.c
index 8bbb84e1f..6aff2f7fc 100644
--- a/newlib/libc/ctype/isblank_l.c
+++ b/newlib/libc/ctype/isblank_l.c
@@ -6,5 +6,5 @@
int
isblank_l (int c, struct __locale_t *locale)
{
- return (__locale_ctype_ptr_l (locale)[c+1] & _B) || (c == '\t');
+ return (__locale_ctype_ptr_l (locale)[c+1] & _ISblank) || (c == '\t');
}
diff --git a/newlib/libc/ctype/iscntrl.c b/newlib/libc/ctype/iscntrl.c
index ebbdd7371..bd99ebafb 100644
--- a/newlib/libc/ctype/iscntrl.c
+++ b/newlib/libc/ctype/iscntrl.c
@@ -48,5 +48,5 @@ No supporting OS subroutines are required.
int
iscntrl (int c)
{
- return(__CTYPE_PTR[c+1] & _C);
+ return(__CTYPE_PTR[c+1] & _IScntrl);
}
diff --git a/newlib/libc/ctype/iscntrl_l.c b/newlib/libc/ctype/iscntrl_l.c
index 0ae17c7f7..85f4d6900 100644
--- a/newlib/libc/ctype/iscntrl_l.c
+++ b/newlib/libc/ctype/iscntrl_l.c
@@ -6,5 +6,5 @@
int
iscntrl_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & _C;
+ return __locale_ctype_ptr_l (locale)[c+1] & _IScntrl;
}
diff --git a/newlib/libc/ctype/isdigit.c b/newlib/libc/ctype/isdigit.c
index a5c511964..911781df3 100644
--- a/newlib/libc/ctype/isdigit.c
+++ b/newlib/libc/ctype/isdigit.c
@@ -47,5 +47,5 @@ No supporting OS subroutines are required.
int
isdigit (int c)
{
- return(__CTYPE_PTR[c+1] & _N);
+ return(__CTYPE_PTR[c+1] & _ISdigit);
}
diff --git a/newlib/libc/ctype/isdigit_l.c b/newlib/libc/ctype/isdigit_l.c
index 1fb79e000..6e24c100c 100644
--- a/newlib/libc/ctype/isdigit_l.c
+++ b/newlib/libc/ctype/isdigit_l.c
@@ -6,5 +6,5 @@
int
isdigit_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & _N;
+ return __locale_ctype_ptr_l (locale)[c+1] & _ISdigit;
}
diff --git a/newlib/libc/ctype/islower.c b/newlib/libc/ctype/islower.c
index 2b3440489..c45c6c8ad 100644
--- a/newlib/libc/ctype/islower.c
+++ b/newlib/libc/ctype/islower.c
@@ -45,5 +45,5 @@ No supporting OS subroutines are required.
int
islower (int c)
{
- return ((__CTYPE_PTR[c+1] & (_U|_L)) == _L);
+ return ((__CTYPE_PTR[c+1] & (_ISupper|_ISlower)) == _ISlower);
}
diff --git a/newlib/libc/ctype/islower_l.c b/newlib/libc/ctype/islower_l.c
index d1f3a82d8..1c66ab48b 100644
--- a/newlib/libc/ctype/islower_l.c
+++ b/newlib/libc/ctype/islower_l.c
@@ -6,5 +6,5 @@
int
islower_l (int c, struct __locale_t *locale)
{
- return (__locale_ctype_ptr_l (locale)[c+1] & (_U|_L)) == _L;
+ return (__locale_ctype_ptr_l (locale)[c+1] & (_ISupper|_ISlower)) == _ISlower;
}
diff --git a/newlib/libc/ctype/isprint.c b/newlib/libc/ctype/isprint.c
index e34fbe28a..7206047fb 100644
--- a/newlib/libc/ctype/isprint.c
+++ b/newlib/libc/ctype/isprint.c
@@ -59,7 +59,7 @@ No supporting OS subroutines are required.
int
isgraph (int c)
{
- return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N));
+ return(__CTYPE_PTR[c+1] & (_ISpunct|_ISupper|_ISlower|_ISdigit));
}
@@ -67,5 +67,5 @@ isgraph (int c)
int
isprint (int c)
{
- return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N|_B));
+ return(__CTYPE_PTR[c+1] & (_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank));
}
diff --git a/newlib/libc/ctype/isprint_l.c b/newlib/libc/ctype/isprint_l.c
index 535504f14..3efaa2f90 100644
--- a/newlib/libc/ctype/isprint_l.c
+++ b/newlib/libc/ctype/isprint_l.c
@@ -6,7 +6,7 @@
int
isgraph_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & (_P|_U|_L|_N);
+ return __locale_ctype_ptr_l (locale)[c+1] & (_ISpunct|_ISupper|_ISlower|_ISdigit);
}
#undef isprint_l
@@ -14,5 +14,5 @@ isgraph_l (int c, struct __locale_t *locale)
int
isprint_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & (_P|_U|_L|_N|_B);
+ return __locale_ctype_ptr_l (locale)[c+1] & (_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank);
}
diff --git a/newlib/libc/ctype/ispunct.c b/newlib/libc/ctype/ispunct.c
index 9c5a3fcca..35f7cc2d4 100644
--- a/newlib/libc/ctype/ispunct.c
+++ b/newlib/libc/ctype/ispunct.c
@@ -47,5 +47,5 @@ No supporting OS subroutines are required.
int
ispunct (int c)
{
- return(__CTYPE_PTR[c+1] & _P);
+ return(__CTYPE_PTR[c+1] & _ISpunct);
}
diff --git a/newlib/libc/ctype/ispunct_l.c b/newlib/libc/ctype/ispunct_l.c
index eeba1f5ae..30c2b48d6 100644
--- a/newlib/libc/ctype/ispunct_l.c
+++ b/newlib/libc/ctype/ispunct_l.c
@@ -6,6 +6,6 @@
int
ispunct_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & _P;
+ return __locale_ctype_ptr_l (locale)[c+1] & _ISpunct;
}
diff --git a/newlib/libc/ctype/isspace.c b/newlib/libc/ctype/isspace.c
index 0def2c0ce..8834d1901 100644
--- a/newlib/libc/ctype/isspace.c
+++ b/newlib/libc/ctype/isspace.c
@@ -46,5 +46,5 @@ No supporting OS subroutines are required.
int
isspace (int c)
{
- return(__CTYPE_PTR[c+1] & _S);
+ return(__CTYPE_PTR[c+1] & _ISspace);
}
diff --git a/newlib/libc/ctype/isspace_l.c b/newlib/libc/ctype/isspace_l.c
index bf4a36c3e..06227c87a 100644
--- a/newlib/libc/ctype/isspace_l.c
+++ b/newlib/libc/ctype/isspace_l.c
@@ -6,6 +6,6 @@
int
isspace_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & _S;
+ return __locale_ctype_ptr_l (locale)[c+1] & _ISspace;
}
diff --git a/newlib/libc/ctype/isupper.c b/newlib/libc/ctype/isupper.c
index aeed383ec..7d916d9f3 100644
--- a/newlib/libc/ctype/isupper.c
+++ b/newlib/libc/ctype/isupper.c
@@ -43,5 +43,5 @@ No supporting OS subroutines are required.
int
isupper (int c)
{
- return ((__CTYPE_PTR[c+1] & (_U|_L)) == _U);
+ return ((__CTYPE_PTR[c+1] & (_ISupper|_ISlower)) == _ISupper);
}
diff --git a/newlib/libc/ctype/isupper_l.c b/newlib/libc/ctype/isupper_l.c
index eb473a7a1..1fdcf1072 100644
--- a/newlib/libc/ctype/isupper_l.c
+++ b/newlib/libc/ctype/isupper_l.c
@@ -6,6 +6,6 @@
int
isupper_l (int c, struct __locale_t *locale)
{
- return (__locale_ctype_ptr_l (locale)[c+1] & (_U|_L)) == _U;
+ return (__locale_ctype_ptr_l (locale)[c+1] & (_ISupper|_ISlower)) == _ISupper;
}
diff --git a/newlib/libc/ctype/isxdigit.c b/newlib/libc/ctype/isxdigit.c
index 2bfe18dbf..fb2a59ea8 100644
--- a/newlib/libc/ctype/isxdigit.c
+++ b/newlib/libc/ctype/isxdigit.c
@@ -46,5 +46,5 @@ No supporting OS subroutines are required.
int
isxdigit (int c)
{
- return(__CTYPE_PTR[c+1] & ((_X)|(_N)));
+ return(__CTYPE_PTR[c+1] & ((_ISxdigit)|(_ISdigit)));
}
diff --git a/newlib/libc/ctype/isxdigit_l.c b/newlib/libc/ctype/isxdigit_l.c
index 726db3190..bbae410c6 100644
--- a/newlib/libc/ctype/isxdigit_l.c
+++ b/newlib/libc/ctype/isxdigit_l.c
@@ -6,6 +6,6 @@
int
isxdigit_l (int c, struct __locale_t *locale)
{
- return __locale_ctype_ptr_l (locale)[c+1] & ((_X)|(_N));
+ return __locale_ctype_ptr_l (locale)[c+1] & ((_ISxdigit)|(_ISdigit));
}