struct icu_buf_utf16 *buf16
= (struct icu_buf_utf16 *) xmalloc(sizeof(struct icu_buf_utf16));
- buf16->utf16 = 0;
buf16->utf16_len = 0;
- buf16->utf16_cap = 0;
-
+ buf16->utf16_cap = capacity;
if (capacity > 0)
{
buf16->utf16 = (UChar *) xmalloc(sizeof(UChar) * capacity);
buf16->utf16[0] = (UChar) 0;
- buf16->utf16_cap = capacity;
}
+ else
+ buf16->utf16 = 0;
return buf16;
}
{
xfree(buf16->utf16);
buf16->utf16 = 0;
- buf16->utf16_len = 0;
}
buf16->utf16_cap = capacity;
return buf16;
struct icu_buf_utf8 *buf8
= (struct icu_buf_utf8 *) xmalloc(sizeof(struct icu_buf_utf8));
- buf8->utf8 = 0;
buf8->utf8_len = 0;
- buf8->utf8_cap = 0;
-
+ buf8->utf8_cap = capacity;
if (capacity > 0)
{
buf8->utf8 = (uint8_t *) xmalloc(sizeof(uint8_t) * capacity);
buf8->utf8[0] = (uint8_t) 0;
- buf8->utf8_cap = capacity;
}
+ else
+ buf8->utf8 = 0;
return buf8;
}
{
xfree(buf8->utf8);
buf8->utf8 = 0;
- buf8->utf8_len = 0;
buf8->utf8_cap = 0;
}