diff options
author | bde <bde@FreeBSD.org> | 1995-04-07 11:52:17 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-04-07 11:52:17 +0000 |
commit | 76e6f5422f092b70e192619fa53058412c766b13 (patch) | |
tree | 4c261639777ed1b89c5712618d7216c38caa9529 /lib/libc | |
parent | d60c039cdc1a7c5a23d38be0c4062ee46545edba (diff) | |
download | FreeBSD-src-76e6f5422f092b70e192619fa53058412c766b13.zip FreeBSD-src-76e6f5422f092b70e192619fa53058412c766b13.tar.gz |
Reviewed by: ache and wollman (long ago)
isctype.c:
o The tolower() and toupper() functions duplicated too much code
and were out of date (surprise). This didn't matter because
it was difficult to call them.
o Change formatting to be more like that in <ctype.h> (with
extra parentheses as in the macros). Perhaps this file should
be machine generated or everything should be handled like
__tolower() so that no code is repeated.
nomacros.c:
o Instead of looking at _USE_CTYPE_INLINE_ to see what <ctype.h>
has done, set _EXTERNALIZE_CTYPE_INLINES_ to tell <ctype.h>
what to do, so that we don't have anything left to do. Note
that code is now generated even if inlines are used by default.
This allows users to switch to non-inline versions.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/locale/isctype.c | 11 | ||||
-rw-r--r-- | lib/libc/locale/nomacros.c | 52 |
2 files changed, 11 insertions, 52 deletions
diff --git a/lib/libc/locale/isctype.c b/lib/libc/locale/isctype.c index 6610e0e..55cfdf0 100644 --- a/lib/libc/locale/isctype.c +++ b/lib/libc/locale/isctype.c @@ -43,7 +43,6 @@ static char sccsid[] = "@(#)isctype.c 8.3 (Berkeley) 2/24/94"; #endif /* LIBC_SCCS and not lint */ -#define _ANSI_LIBRARY #include <ctype.h> #undef isalnum @@ -51,7 +50,7 @@ int isalnum(c) int c; { - return(__istype((c), (_A|_D))); + return (__istype((c), (_A|_D))); } #undef isalpha @@ -67,7 +66,7 @@ int isascii(c) int c; { - return((c & ~0x7F) == 0); + return (((c) & ~0x7F) == 0); } #undef isblank @@ -155,7 +154,7 @@ int toascii(c) int c; { - return (c & 0177); + return ((c) & 0x7F); } #undef tolower @@ -163,7 +162,7 @@ int tolower(c) int c; { - return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]); + return (__tolower(c)); } #undef toupper @@ -171,5 +170,5 @@ int toupper(c) int c; { - return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]); + return (__toupper(c)); } diff --git a/lib/libc/locale/nomacros.c b/lib/libc/locale/nomacros.c index 3880e10..45c0db7 100644 --- a/lib/libc/locale/nomacros.c +++ b/lib/libc/locale/nomacros.c @@ -1,49 +1,9 @@ -#include <ctype.h> -#include <rune.h> - -#if !defined(_USE_CTYPE_INLINE_) && !defined(_USE_CTYPE_MACROS_) /* - * See comments in <machine/ansi.h> + * Tell <ctype.h> to generate extern versions of all its inline + * functions. The extern versions get called if the system doesn't + * support inlines or the user defines _DONT_USE_CTYPE_INLINE_ + * before including <ctype.h>. */ -int -__istype(c, f) - _BSD_RUNE_T_ c; - unsigned long f; -{ - if (c < 0) - c = (unsigned char) c; - return ((((c & _CRMASK) ? ___runetype(c) - : _CurrentRuneLocale->runetype[c]) & f) ? 1 : 0); -} - -int -__isctype(_BSD_RUNE_T_ c, unsigned long f) - _BSD_RUNE_T_ c; - unsigned long f; -{ - if (c < 0) - c = (unsigned char) c; - return ((((c & _CRMASK) ? 0 - : _DefaultRuneLocale.runetype[c]) & f) ? 1 : 0); -} +#define _EXTERNALIZE_CTYPE_INLINES_ -_BSD_RUNE_T_ -toupper(c) - _BSD_RUNE_T_ c; -{ - if (c < 0) - c = (unsigned char) c; - return ((c & _CRMASK) ? - ___toupper(c) : _CurrentRuneLocale->mapupper[c]); -} - -_BSD_RUNE_T_ -tolower(c) - _BSD_RUNE_T_ c; -{ - if (c < 0) - c = (unsigned char) c; - return ((c & _CRMASK) ? - ___tolower(c) : _CurrentRuneLocale->maplower[c]); -} -#endif +#include <ctype.h> |