Print this page
Thread safety fixes.


  68          */
  69         "%a %b %e %H:%M:%S %Y",
  70 
  71         /* am */
  72         "AM",
  73 
  74         /* pm */
  75         "PM",
  76 
  77         /* date_fmt */
  78         "%a %b %e %H:%M:%S %Z %Y",
  79 
  80         /*
  81          * ampm_fmt - To determine 12-hour clock format time (empty, if N/A)
  82          */
  83         "%I:%M:%S %p"
  84 };
  85 
  86 struct locdata __posix_time_locdata = {
  87         .l_lname = "C",
  88         .l_refcnt = (uint32_t)-1,
  89         .l_data = { &lc_time_posix }
  90 };
  91 
  92 struct locdata *
  93 __lc_time_load(const char *name)
  94 {
  95         struct locdata  *ldata;
  96         struct lc_time  *ltime;
  97         int ret;
  98 
  99         if ((ldata = __locdata_alloc(name, sizeof (*ltime))) == NULL) {
 100                 errno = EINVAL;
 101                 return (NULL);
 102         }
 103         ltime = ldata->l_data[0];
 104 
 105         ret = __part_load_locale(name, (char **)&ldata->l_data[1],
 106             "LC_TIME", LCTIME_SIZE, LCTIME_SIZE, (const char **)ltime);
 107 
 108         if (ret != _LDP_LOADED) {
 109                 __locdata_release(ldata);
 110                 errno = EINVAL;
 111                 return (NULL);
 112         }
 113 
 114         return (ldata);
 115 }


  68          */
  69         "%a %b %e %H:%M:%S %Y",
  70 
  71         /* am */
  72         "AM",
  73 
  74         /* pm */
  75         "PM",
  76 
  77         /* date_fmt */
  78         "%a %b %e %H:%M:%S %Z %Y",
  79 
  80         /*
  81          * ampm_fmt - To determine 12-hour clock format time (empty, if N/A)
  82          */
  83         "%I:%M:%S %p"
  84 };
  85 
  86 struct locdata __posix_time_locdata = {
  87         .l_lname = "C",

  88         .l_data = { &lc_time_posix }
  89 };
  90 
  91 struct locdata *
  92 __lc_time_load(const char *name)
  93 {
  94         struct locdata  *ldata;
  95         struct lc_time  *ltime;
  96         int ret;
  97 
  98         if ((ldata = __locdata_alloc(name, sizeof (*ltime))) == NULL) {
  99                 errno = EINVAL;
 100                 return (NULL);
 101         }
 102         ltime = ldata->l_data[0];
 103 
 104         ret = __part_load_locale(name, (char **)&ldata->l_data[1],
 105             "LC_TIME", LCTIME_SIZE, LCTIME_SIZE, (const char **)ltime);
 106 
 107         if (ret != _LDP_LOADED) {
 108                 __locdata_free(ldata);
 109                 errno = EINVAL;
 110                 return (NULL);
 111         }
 112 
 113         return (ldata);
 114 }