• Paul Eggert's avatar
    c-ctype: rewrite to use inline functions · 43a090ce
    Paul Eggert authored
    This simplifies maintenance, since it makes for just one
    implementation of each function, letting the compiler have the fun
    of optimization.  In practice this works well nowadays with GCC.
    E.g., c_isascii might need only three instructions even though the
    source code lists every ASCII character individually in a large
    switch statement.
    Also, fix some z/OS porting bugs reported by Daniel Richard G. in:
    * NEWS: Document the API change.
    * lib/c-ctype.c: Drastically simplify, since this now just expands
    inline functions.
    (C_CTYPE_INLINE): New macro.
    Verify that either ASCII or EBCDIC is being used.
    New private macros.
    (_C_CTYPE_CNTRL): In EBCDIC, '\x07' is a control, not '\xff'.
    (c_isalnum, c_isalpha, c_isascii, c_isblank, c_iscntrl, c_isdigit)
    (c_isgraph, c_islower, c_isprint, c_ispunct, c_isspace, c_isupper)
    (c_isxdigit, c_tolower, c_toupper): Now inline functions.
    (c_tolower, c_toupper): When converting, return the unsigned char,
    as that is what z/OS does.
    * lib/c-strcaseeq.h (CASEEQ): Simplify in the light of the removal
    of some c-ctype.h macros.
    * modules/c-ctype (Depends-on): Add extern-inline; remove verify.
    * tests/test-c-ctype.c (test_all): Fix test for c_toupper and
    c_tolower promotion to be compatible with z/OS.