Print this page
6596 Macro redefined in strtolctype.h

Split Close
Expand all
Collapse all
          --- old/usr/src/common/util/strtolctype.h
          +++ new/usr/src/common/util/strtolctype.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
       23 + * Copyright 2016 Gary Mills
  23   24   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   */
  26   27  
  27   28  /*      Copyright (c) 1988 AT&T */
  28   29  /*        All Rights Reserved   */
  29   30  
  30      -#ifndef _COMMON_UTIL_CTYPE_H
  31      -#define _COMMON_UTIL_CTYPE_H
       31 +#ifndef _COMMON_UTIL_STRTOLCTYPE_H
       32 +#define _COMMON_UTIL_STRTOLCTYPE_H
  32   33  
  33   34  #ifdef  __cplusplus
  34   35  extern "C" {
  35   36  #endif
  36   37  
  37   38  /*
  38      - * This header file contains a collection of macros that the strtou?ll?
  39      - * functions in common/util use to test characters.  What we need is a kernel
  40      - * version of ctype.h.
       39 + * This is a private header file containing a collection of macros that
       40 + * the strtou?ll? functions in common/util use to test characters.  Which
       41 + * macros are defined depends on which of _KERNEL or _BOOT are defined.
       42 + * New code should use the kernel version of ctype.h: <sys/ctype.h>.
  41   43   *
  42   44   * NOTE: These macros are used within several DTrace probe context functions.
  43   45   * They must not be altered to make function calls or perform actions not
  44   46   * safe in probe context.
  45   47   */
  46   48  
  47      -#if     defined(_KERNEL) || defined(_BOOT)
       49 +/*
       50 + * Cases that define these macros:
       51 + *   _KERNEL && !_BOOT: Used by kernel functions
       52 + *   !_KERNEL && _BOOT: Used by dboot_startkern.c for x86 boot
       53 + * Cases that omit these macros:
       54 + *   _KERNEL && _BOOT: Used by common/util/strtol.c for SPARC boot library
       55 + *   !_KERNEL && !_BOOT: Used by strtou?ll? functions in libc
       56 + */
       57 +#if     defined(_KERNEL) ^ defined(_BOOT)
  48   58  
  49   59  #define isalnum(ch)     (isalpha(ch) || isdigit(ch))
  50   60  #define isalpha(ch)     (isupper(ch) || islower(ch))
  51   61  #define isdigit(ch)     ((ch) >= '0' && (ch) <= '9')
  52   62  #define islower(ch)     ((ch) >= 'a' && (ch) <= 'z')
  53   63  #define isspace(ch)     (((ch) == ' ') || ((ch) == '\r') || ((ch) == '\n') || \
  54   64                          ((ch) == '\t') || ((ch) == '\f'))
  55   65  #define isupper(ch)     ((ch) >= 'A' && (ch) <= 'Z')
  56   66  #define isxdigit(ch)    (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \
  57   67                          ((ch) >= 'A' && (ch) <= 'F'))
  58   68  
  59      -#endif  /* _KERNEL || _BOOT */
       69 +#endif  /* _KERNEL ^ _BOOT */
  60   70  
       71 +/*
       72 + * The following macros are defined unconditionally.
       73 + */
       74 +
  61   75  #define DIGIT(x)        \
  62   76          (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
  63   77  
  64   78  #define MBASE   ('z' - 'a' + 1 + 10)
  65   79  
  66   80  /*
  67   81   * The following macro is a version of isalnum() that limits alphabetic
  68   82   * characters to the ranges a-z and A-Z; locale dependent characters will not
  69   83   * return 1.  The members of a-z and A-Z are assumed to be in ascending order
  70   84   * and contiguous.
  71   85   */
  72   86  #define lisalnum(x)     \
  73   87          (isdigit(x) || ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z'))
  74   88  
  75   89  #ifdef  __cplusplus
  76   90  }
  77   91  #endif
  78   92  
  79      -#endif  /* _COMMON_UTIL_CTYPE_H */
       93 +#endif  /* _COMMON_UTIL_STRTOLCTYPE_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX