Print this page
2964 need POSIX 2008 locale object support

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/collate.c
          +++ new/usr/src/lib/libc/port/locale/collate.c
↓ open down ↓ 57 lines elided ↑ open up ↑
  58   58  static collate_large_t          *large_pri_table;
  59   59  static collate_chain_t          *chain_pri_table;
  60   60  static char                     *cache = NULL;
  61   61  static size_t                   cachesz;
  62   62  static char                     collate_encoding[ENCODING_LEN + 1];
  63   63  
  64   64  /* Exposed externally to other parts of libc. */
  65   65  collate_info_t                  *_collate_info;
  66   66  int _collate_load_error = 1;
  67   67  
       68 +struct xlocale_collate __xlocale_global_collate = {
       69 +        {{0}, "C"}, 1, 0
       70 +};
       71 +
       72 +struct xlocale_collate __xlocale_C_collate = {
       73 +        {{0}, "C"}, 1, 0
       74 +};
       75 +
       76 +static void
       77 +destruct_collate(void *t)
       78 +{
       79 +        struct xlocale_collate *table = t;
       80 +
       81 +        /* XXX */;
       82 +}
       83 +
       84 +void *
       85 +__collate_load(const char *encoding, locale_t unused)
       86 +{
       87 +        struct xlocale_collate *table;
       88 +
       89 +        if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
       90 +                return &__xlocale_C_collate;
       91 +        }
       92 +
       93 +        table = calloc(sizeof(struct xlocale_collate), 1);
       94 +        if (table == NULL) {
       95 +                /* XXX */
       96 +        }
       97 +
       98 +        return (table);
       99 +}
  68  100  
  69  101  int
  70  102  _collate_load_tables(const char *encoding)
  71  103  {
  72  104          int i, chains, z;
  73  105          char buf[PATH_MAX];
  74  106          char *TMP;
  75  107          char *map;
  76  108          collate_info_t *info;
  77  109          struct stat sbuf;
↓ open down ↓ 560 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX