Print this page
Fix compile errors, code review feedback, and add basic libc test suite.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/setlocale.c
          +++ new/usr/src/lib/libc/port/locale/setlocale.c
↓ open down ↓ 64 lines elided ↑ open up ↑
  65   65          locale_t oldloc;
  66   66          locale_t newloc;
  67   67          int mask;
  68   68  
  69   69          if (category < 0 || category > LC_ALL) {
  70   70                  errno = EINVAL;
  71   71                  return (NULL);
  72   72          }
  73   73  
  74   74          if (locname == NULL)
  75      -                return (current_locale(__global_locale, category));
       75 +                return (current_locale(___global_locale, category));
  76   76  
  77      -        if ((oldloc = duplocale(__global_locale)) == NULL)
       77 +        if ((oldloc = duplocale(___global_locale)) == NULL)
  78   78                  return (NULL);
  79   79  
  80   80          mask = (category == LC_ALL ? LC_ALL_MASK : (1 << category));
  81   81  
  82   82          newloc = newlocale(mask, locname, oldloc);
  83   83          if (newloc == NULL) {
  84   84                  freelocale(oldloc);
  85   85                  return (NULL);
  86   86          }
  87   87  
  88      -        oldloc = __global_locale;
  89      -        __global_locale = newloc;
       88 +        oldloc = ___global_locale;
       89 +        ___global_locale = newloc;
  90   90  
  91   91          install_legacy(newloc, mask);
  92   92  
  93   93          freelocale(oldloc);
  94   94          return (current_locale(newloc, category));
  95   95  }
  96   96  
  97   97  static char *
  98   98  current_locale(locale_t loc, int cat)
  99   99  {
↓ open down ↓ 82 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX