Print this page
make: use the more modern wchar routines, not widec.h

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/include/mksh/defs.h
          +++ new/usr/src/cmd/make/include/mksh/defs.h
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29  #include <stdio.h>
  30   30  #include <stdlib.h>             /* wchar_t */
  31   31  #include <string.h>             /* strcmp() */
  32   32  #include <sys/param.h>          /* MAXPATHLEN */
  33   33  #include <sys/types.h>          /* time_t, caddr_t */
  34   34  #include <vroot/vroot.h>        /* pathpt */
  35   35  #include <sys/time.h>           /* timestruc_t */
  36   36  #include <errno.h>              /* errno */
  37   37  
  38   38  #include <wctype.h>
  39      -#include <widec.h>
  40      -
  41   39  
  42   40  /*
  43   41   * A type and some utilities for boolean values
  44   42   */
  45   43  
  46   44  #define false   BOOLEAN_false
  47   45  #define true    BOOLEAN_true
  48   46  
  49   47  typedef enum {
  50   48          false =         0,
↓ open down ↓ 100 lines elided ↑ open up ↑
 151  149  
 152  150  /*
 153  151   * Some utility macros
 154  152   */
 155  153  #define ALLOC(x)                ((struct _##x *)getmem(sizeof (struct _##x)))
 156  154  #define ALLOC_WC(x)             ((wchar_t *)getmem((x) * SIZEOFWCHAR_T))
 157  155  #define FIND_LENGTH             -1
 158  156  #define GETNAME(a,b)            getname_fn((a), (b), false)
 159  157  #define IS_EQUAL(a,b)           (!strcmp((a), (b)))
 160  158  #define IS_EQUALN(a,b,n)        (!strncmp((a), (b), (n)))
 161      -#define IS_WEQUAL(a,b)          (!wscmp((a), (b)))
 162      -#define IS_WEQUALN(a,b,n)       (!wsncmp((a), (b), (n)))
      159 +#define IS_WEQUAL(a,b)          (!wcscmp((a), (b)))
      160 +#define IS_WEQUALN(a,b,n)       (!wcsncmp((a), (b), (n)))
 163  161  #define MBLEN(a)                mblen((a), MB_LEN_MAX)
 164  162  #define MBSTOWCS(a,b)           (void) mbstowcs_with_check((a), (b), MAXPATHLEN)
 165  163  #define MBTOWC(a,b)             mbtowc((a), (b), MB_LEN_MAX)
 166  164  #define SIZEOFWCHAR_T           (sizeof (wchar_t))
 167  165  #define VSIZEOF(v)              (sizeof (v) / sizeof ((v)[0]))
 168  166  #define WCSTOMBS(a,b)           (void) wcstombs((a), (b), (MAXPATHLEN * MB_LEN_MAX))
 169  167  #define WCTOMB(a,b)             (void) wctomb((a), (b))
 170  168  #define HASH(v, c)              (v = (v)*31 + (unsigned int)(c))
 171  169  
 172  170  extern void mbstowcs_with_check(wchar_t *pwcs, const char *s, size_t n);
↓ open down ↓ 64 lines elided ↑ open up ↑
 237  235                  wchar_t         string_buf[STRING_BUFFER_LENGTH];
 238  236  
 239  237          public:
 240  238                  Wstring();
 241  239                  Wstring(struct _Name * name);
 242  240                  ~Wstring();
 243  241  
 244  242                  void init(struct _Name * name);
 245  243                  void init(wchar_t * name, unsigned length);
 246  244                  unsigned length() {
 247      -                        return wslen(string.buffer.start);
      245 +                        return wcslen(string.buffer.start);
 248  246                  };
 249  247                  void append_to_str(struct _String * str, unsigned off, unsigned length);
 250  248  
 251  249                  wchar_t * get_string() {
 252  250                          return string.buffer.start;
 253  251                  };
 254  252  
 255  253                  wchar_t * get_string(unsigned off) {
 256  254                          return string.buffer.start + off;
 257  255                  };
↓ open down ↓ 690 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX