Print this page
Thread safety fixes.


  45 
  46 #include "collate.h"
  47 #include "setlocale.h"
  48 
  49 /*
  50  * See the comments in usr/src/cmd/localedef/collate.c for further
  51  * information.  It would also be very helpful to have a copy of the
  52  * POSIX standard for collation (in the locale format manual page)
  53  * handy (www.opengroup.org).
  54  */
  55 
  56 /*
  57  * POSIX uses empty tables and falls down to strcmp.
  58  */
  59 struct lc_collate lc_collate_posix = {
  60         .lc_is_posix = 1,
  61 };
  62 
  63 struct locdata __posix_collate_locdata = {
  64         .l_lname = "C",
  65         .l_refcnt = (uint32_t)-1,
  66         .l_data = { &lc_collate_posix }
  67 };
  68 
  69 
  70 struct locdata *
  71 __lc_collate_load(const char *locname)
  72 {
  73         int i, chains, z;
  74         char buf[PATH_MAX];
  75         char *TMP;
  76         char *map;
  77         collate_info_t *info;
  78         struct stat sbuf;
  79         int fd;
  80         struct locdata *ldata;
  81         struct lc_collate *lcc;
  82 
  83         /*
  84          * Slurp the locale file into the cache.
  85          */




  45 
  46 #include "collate.h"
  47 #include "setlocale.h"
  48 
  49 /*
  50  * See the comments in usr/src/cmd/localedef/collate.c for further
  51  * information.  It would also be very helpful to have a copy of the
  52  * POSIX standard for collation (in the locale format manual page)
  53  * handy (www.opengroup.org).
  54  */
  55 
  56 /*
  57  * POSIX uses empty tables and falls down to strcmp.
  58  */
  59 struct lc_collate lc_collate_posix = {
  60         .lc_is_posix = 1,
  61 };
  62 
  63 struct locdata __posix_collate_locdata = {
  64         .l_lname = "C",

  65         .l_data = { &lc_collate_posix }
  66 };
  67 
  68 
  69 struct locdata *
  70 __lc_collate_load(const char *locname)
  71 {
  72         int i, chains, z;
  73         char buf[PATH_MAX];
  74         char *TMP;
  75         char *map;
  76         collate_info_t *info;
  77         struct stat sbuf;
  78         int fd;
  79         struct locdata *ldata;
  80         struct lc_collate *lcc;
  81 
  82         /*
  83          * Slurp the locale file into the cache.
  84          */