9namespace string_functions {
12int itoa(
int value,
char *sp,
int radix) {
18 int sign = (radix == 10 && value < 0);
24 while (v || tp == tmp) {
48void StringFormatter::append(
int val,
StrN<64> *dst) {
50 string_functions::itoa(val, buf, 63);
54StringHolder::StringHolder(
const char *str) {
55 mLength = strlen(str);
56 mData = (
char *)malloc(mLength + 1);
58 memcpy(mData, str, mLength + 1);
65StringHolder::StringHolder(
size_t length) {
66 mData = (
char *)malloc(length + 1);
69 mData[mLength] =
'\0';
76StringHolder::~StringHolder() {
80void StringHolder::grow(
size_t newLength) {
81 if (newLength <= mCapacity) {
86 char *newData = (
char *)realloc(mData, newLength + 1);
90 mCapacity = newLength;
91 mData[mLength] =
'\0';
94 char *newData = (
char *)malloc(newLength + 1);
96 memcpy(newData, mData, mLength + 1);