Print this page
locale stuff should use libc safe lmalloc.  Other fixes from tests.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/lmonetary.c
          +++ new/usr/src/lib/libc/port/locale/lmonetary.c
↓ open down ↓ 25 lines elided ↑ open up ↑
  26   26   * SUCH DAMAGE.
  27   27   */
  28   28  
  29   29  #include "lint.h"
  30   30  #include <limits.h>
  31   31  #include <stddef.h>
  32   32  #include <stdlib.h>
  33   33  #include <stdio.h>
  34   34  #include <string.h>
  35   35  #include <errno.h>
       36 +#include "libc.h"
  36   37  #include "ldpart.h"
  37   38  #include "lmonetary.h"
  38   39  #include "localeimpl.h"
  39   40  
  40   41  extern const char *__fix_locale_grouping_str(const char *);
  41   42  
  42   43  #define LCMONETARY_SIZE_FULL (sizeof (struct lc_monetary) / sizeof (char *))
  43   44  #define LCMONETARY_SIZE_MIN \
  44   45          (offsetof(struct lc_monetary, int_p_cs_precedes) / sizeof (char *))
  45   46  
↓ open down ↓ 58 lines elided ↑ open up ↑
 104  105              (const char **)lmon);
 105  106  
 106  107          if (ret != _LDP_LOADED) {
 107  108                  __locdata_free(ldata);
 108  109                  errno = EINVAL;
 109  110                  return (NULL);
 110  111          }
 111  112  
 112  113          /* special storage for currency string */
 113  114          clen = strlen(lmon->currency_symbol) + 2;
 114      -        ldata->l_data[2] = malloc(clen);
      115 +        ldata->l_data[2] = libc_malloc(clen);
 115  116          lmon->crncystr = ldata->l_data[2];
 116      -        lmon->crncystr[0] = '\0';
 117  117  
 118  118          lmon->mon_grouping = __fix_locale_grouping_str(lmon->mon_grouping);
 119  119  
 120  120  #define M_ASSIGN_CHAR(NAME) \
 121  121          (((char *)lmon->NAME)[0] = cnv(lmon->NAME))
 122  122  
 123  123          M_ASSIGN_CHAR(int_frac_digits);
 124  124          M_ASSIGN_CHAR(frac_digits);
 125  125          M_ASSIGN_CHAR(p_cs_precedes);
 126  126          M_ASSIGN_CHAR(p_sep_by_space);
↓ open down ↓ 53 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX