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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/rep.cc
          +++ new/usr/src/cmd/make/bin/rep.cc
↓ open down ↓ 93 lines elided ↑ open up ↑
  94   94          fp = fopen(nse_depinfo, "r");
  95   95          if (fp == NULL) {
  96   96                  return;
  97   97          }
  98   98          line_size = MAXPATHLEN;
  99   99          line_index = line_size - 1;
 100  100          line = ALLOC_WC(line_size);
 101  101          Wstring rns(recursive_name);
 102  102          wchar_t * wcb = rns.get_string();
 103  103          while (fgetws(line, line_size, fp) != NULL) {
 104      -                while (wslen(line) == line_index) {
 105      -                        if (line[wslen(line) - 1] == '\n') {
      104 +                while (wcslen(line) == line_index) {
      105 +                        if (line[wcslen(line) - 1] == '\n') {
 106  106                                  continue;
 107  107                          }
 108  108                          bigger_line = ALLOC_WC(2 * line_size);
 109      -                        wscpy(bigger_line, line);
      109 +                        wcscpy(bigger_line, line);
 110  110                          retmem(line);
 111  111                          line = bigger_line;
 112  112                          if (fgetws(&line[line_index], line_size, fp) == NULL)
 113  113                                  continue;
 114  114                          line_index = 2 * line_index;
 115  115                          line_size = 2 * line_size;
 116  116                  }
 117  117  
 118      -                colon = (wchar_t *) wschr(line, (int) colon_char);
      118 +                colon = (wchar_t *) wcschr(line, (int) colon_char);
 119  119                  if (colon == NULL) {
 120  120                          continue;
 121  121                  }
 122      -                dollar = (wchar_t *) wschr(line, (int) dollar_char);
 123      -                line[wslen(line) - 1] = (int) nul_char;
      122 +                dollar = (wchar_t *) wcschr(line, (int) dollar_char);
      123 +                line[wcslen(line) - 1] = (int) nul_char;
 124  124                  if (IS_WEQUALN(&colon[2], wcb,
 125  125                      (int) recursive_name->hash.length)) {
 126  126                          /*
 127  127                           * If this entry is an old entry, ignore it
 128  128                           */
 129  129                          MBSTOWCS(wcs_buffer, DEPINFO_FMT_VERSION);
 130  130                          if (dollar == NULL ||
 131  131                              !IS_WEQUALN(wcs_buffer, (dollar+1) - VER_LEN, VER_LEN)){
 132  132                                  continue;
 133  133                              }
 134  134                          rp = ALLOC(Recursive_make);
 135  135                          (void) memset((char *) rp, 0, sizeof (Recursive_make_rec));
 136  136                          /*
 137  137                           * set conditional_macro_string if string is present
 138  138                           */
 139      -                        rp->oldline = (wchar_t *) wsdup(line);
      139 +                        rp->oldline = (wchar_t *) wcsdup(line);
 140  140                          if ( dollar != NULL ){
 141  141                                  rp->cond_macrostring = 
 142      -                                    (wchar_t *) wsdup(dollar - VER_LEN + 1);
      142 +                                    (wchar_t *) wcsdup(dollar - VER_LEN + 1);
 143  143                          }
 144  144                          /* 
 145  145                           * get target name into recursive struct
 146  146                           */
 147  147                          *colon = (int) nul_char;
 148      -                        rp->target = (wchar_t *) wsdup(line);
      148 +                        rp->target = (wchar_t *) wcsdup(line);
 149  149                          *bpatch = rp;
 150  150                          bpatch = &rp->next;
 151  151                  }
 152  152          }
 153  153          (void) fclose(fp);
 154  154  }
 155  155  
 156  156  /*
 157  157   *      report_recursive_dep(target, line)
 158  158   *
↓ open down ↓ 17 lines elided ↑ open up ↑
 176  176          cond_macros_into_string(target, &string);
 177  177          /* 
 178  178           * find an applicable recursive entry, if there isn't one, create it
 179  179           */
 180  180          rp = find_recursive_target(target);
 181  181          if (rp == NULL) {
 182  182                  rp = ALLOC(Recursive_make);
 183  183                  (void) memset((char *) rp, 0, sizeof (Recursive_make_rec));
 184  184                  wchar_t * wcb = get_wstring(target->string_mb); // XXX Tolik: needs retmem
 185  185                  rp->target = wcb;
 186      -                rp->newline = (wchar_t *) wsdup(line);
 187      -                rp->cond_macrostring = (wchar_t *) wsdup(rec_buf);
      186 +                rp->newline = (wchar_t *) wcsdup(line);
      187 +                rp->cond_macrostring = (wchar_t *) wcsdup(rec_buf);
 188  188                  *bpatch = rp;
 189  189                  bpatch = &rp->next;
 190  190                  changed = true;
 191  191          } else {
 192  192                  if ((rp->oldline != NULL) && !IS_WEQUAL(rp->oldline, line)) {
 193      -                        rp->newline = (wchar_t *) wsdup(line);
      193 +                        rp->newline = (wchar_t *) wcsdup(line);
 194  194                          changed = true;
 195  195                  }
 196  196                  rp->removed = false;
 197  197          }
 198  198  }
 199  199  
 200  200  /*
 201  201   *      find_recursive_target(target)
 202  202   *
 203  203   *      Search the list for a given target.
↓ open down ↓ 191 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX