From owner-freebsd-commit Fri Apr 7 04:52:27 1995 Return-Path: commit-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id EAA04363 for commit-outgoing; Fri, 7 Apr 1995 04:52:27 -0700 Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id EAA04350 for cvs-lib-outgoing; Fri, 7 Apr 1995 04:52:25 -0700 Received: (from bde@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id EAA04340 ; Fri, 7 Apr 1995 04:52:19 -0700 Date: Fri, 7 Apr 1995 04:52:19 -0700 From: Bruce Evans Message-Id: <199504071152.EAA04340@freefall.cdrom.com> To: CVS-commiters, cvs-lib Subject: cvs commit: src/lib/libc/locale isctype.c nomacros.c Sender: commit-owner@FreeBSD.org Precedence: bulk bde 95/04/07 04:52:18 Modified: include ctype.h Log: Reviewed by: ache and wollman (long ago) Fix numerous ANSI conformance bugs and other nits. ctype.h: o There were no prototypes behind the macros (conformance bug). o isascii() didn't have enough parentheses (plain bug). o tolower() and toupper were always static inline (conformance bug? You could undef them and take their address, but this gave different addresses in different modules. You couldn't undef them and declare them (correctly) again). 's treatment of putc() shows one way to handle this problem, but it only works because the putc() macro is allowed to reevaluate its args. I used a hack controlled by _EXTERNALIZE_CTYPE_INLINES_ to get to generate the code (the previous hack involving _ANSI_LIBRARY_ goes away). This has the advantage that the core of the functions is only written down once and the disadvantage that another layer of functions is required. The extra layer goes away if inline functions are used, leaving only the problem of understanding why there are functions named toupper(), __toupper and ___toupper() as well as a macro named toupper. o Nothing seems to define _USE_CTYPE_LIBRARY_. Eliminate it o Let the user set _USE_CTYPE_INLINE_ and _DONT_USE_CTYPE_INLINE_ for full control over inlining. o The args for the inline functions didn't have enough underscores (conformance bug). o The formatting and ordering was inconsistent (style bug). o TODO: fix conformance bugs brought by including . Modified: lib/libc/locale isctype.c nomacros.c Log: 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 (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 has done, set _EXTERNALIZE_CTYPE_INLINES_ to tell 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.