summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2024-02-04 13:03:19 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2024-02-04 13:03:19 +0000
commit7aed1b3e7b8bbcaae813e0558883199f4b353996 (patch)
treeaf5d62394ef5686b1d93e08d51869fe8b0d6f819 /include
parent1e8ee668515bc7f88161b37ce48dbd452db7803f (diff)
Move ctype.h defines to the _CTYPE_ prefix, avoids clashes with identifiers in ports
Even if those _[BCNLPSUX] defines are in the reserved namespace, some ports make use of those identifiers and thus need pointless headscratching and patches. Just use a longer reserved prefix. We can't just #undef those defines as they are used in libc. Change similar to what NetBSD did around 2010. Went through base builds and an amd64 bulk build, the only fallout was lib(e)stdc++ base_ctype.h. "make includes" will install the latest ctype.h and libstdc++ ctype_base.h. "makes sense" deraadt@, ok sthen@ tb@
Diffstat (limited to 'include')
-rw-r--r--include/ctype.h45
1 files changed, 25 insertions, 20 deletions
diff --git a/include/ctype.h b/include/ctype.h
index e90d375c8d2..6dd2ced25ea 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctype.h,v 1.25 2017/09/05 03:16:13 schwarze Exp $ */
+/* $OpenBSD: ctype.h,v 1.26 2024/02/04 13:03:18 jca Exp $ */
/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */
/*
@@ -42,14 +42,14 @@
#include <sys/cdefs.h>
-#define _U 0x01
-#define _L 0x02
-#define _N 0x04
-#define _S 0x08
-#define _P 0x10
-#define _C 0x20
-#define _X 0x40
-#define _B 0x80
+#define _CTYPE_U 0x01
+#define _CTYPE_L 0x02
+#define _CTYPE_N 0x04
+#define _CTYPE_S 0x08
+#define _CTYPE_P 0x10
+#define _CTYPE_C 0x20
+#define _CTYPE_X 0x40
+#define _CTYPE_B 0x80
#if __POSIX_VISIBLE >= 200809
#ifndef _LOCALE_T_DEFINED_
@@ -114,57 +114,62 @@ int toupper_l(int, locale_t);
__only_inline int isalnum(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_U|_L|_N)));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] &
+ (_CTYPE_U|_CTYPE_L|_CTYPE_N)));
}
__only_inline int isalpha(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_U|_L)));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] &
+ (_CTYPE_U|_CTYPE_L)));
}
__only_inline int iscntrl(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _C));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_C));
}
__only_inline int isdigit(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _N));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_N));
}
__only_inline int isgraph(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_P|_U|_L|_N)));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] &
+ (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)));
}
__only_inline int islower(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _L));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_L));
}
__only_inline int isprint(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_P|_U|_L|_N|_B)));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] &
+ (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)));
}
__only_inline int ispunct(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _P));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_P));
}
__only_inline int isspace(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _S));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_S));
}
__only_inline int isupper(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _U));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_U));
}
__only_inline int isxdigit(int _c)
{
- return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_N|_X)));
+ return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] &
+ (_CTYPE_N|_CTYPE_X)));
}
__only_inline int tolower(int _c)