Refactored for ISO C standard

This commit is contained in:
Gitea 2020-12-21 13:52:28 -06:00
parent 37a4379512
commit 9cf547ce87

View file

@ -12,6 +12,8 @@
#ifndef _FLC_LIMITS #ifndef _FLC_LIMITS
#define _FLC_LIMITS #define _FLC_LIMITS
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
/* /*
Minimum values (POSIX) Minimum values (POSIX)
Included in case anyone wants/needs 'em. Included in case anyone wants/needs 'em.
@ -110,7 +112,20 @@
/* Maximum values */ /* Maximum values */
#define _POSIX_CLOCKRES_MIN 20000000 #define _POSIX_CLOCKRES_MIN 20000000
/* Numerical limits */ /* ssize_t size limit*/
#define SSIZE_MAX 32767
/* Miscellaneous invariants */
#define NL_ARGMAX 9
#define NL_LANGMAX 14
#define NL_MSGMAX 65535
#define NL_SETMAX 255
#define NL_TEXTMAX 8192
#define NZERO 20
#endif
/* Numerical limits as defined in the ISO C standard */
/* Shorts (Defined as 16-bit) */ /* Shorts (Defined as 16-bit) */
#define SHRT_MAX 32767 #define SHRT_MAX 32767
#define SHRT_MIN -32767 #define SHRT_MIN -32767
@ -131,21 +146,20 @@
#define ULLONG_MAX 18446744073709551615ULL #define ULLONG_MAX 18446744073709551615ULL
/* Characters (Defined as 8 bit) */ /* Characters (Defined as 8 bit) */
#define CHAR_BIT 8 #define CHAR_BIT 8
#if '\xff' > 0
#define CHAR_MAX 255
#define CHAR_MIN 0
#else
#define CHAR_MAX 127 #define CHAR_MAX 127
#define CHAR_MIN -128 #define CHAR_MIN -128
#endif
#define SCHAR_MAX 127 #define SCHAR_MAX 127
#define SCHAR_MIN -128 #define SCHAR_MIN -128
#define UCHAR_MAX 255 #define UCHAR_MAX 255
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
#define MB_LEN_MAX 4 #define MB_LEN_MAX 4
/* ssize_t */ #else
#define SSIZE_MAX 32767 #define MB_LEN_MAX 1
#endif
/* Miscellaneous invariants */
#define NL_ARGMAX 9
#define NL_LANGMAX 14
#define NL_MSGMAX 65535
#define NL_SETMAX 255
#define NL_TEXTMAX 8192
#define NZERO 20
#endif /* ndef _FLC_LIMITS */ #endif /* ndef _FLC_LIMITS */