124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
if (str->cstr != NULL)
free(str->cstr);
str->cstr = copy;
str->len = strlen(copy);
return true;
}
static CFWClass class = {
.name = "CFWString",
.size = sizeof(CFWString),
.ctor = ctor,
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
if (str->cstr != NULL)
free(str->cstr);
str->cstr = copy;
str->len = strlen(copy);
return true;
}
bool
cfw_string_append(CFWString *str, CFWString *append)
{
char *new;
if ((new = realloc(str->cstr, str->len + append->len + 1)) == NULL)
return false;
memcpy(new + str->len, append->cstr, append->len);
new[str->len + append->len] = 0;
str->cstr = new;
str->len += append->len;
return true;
}
static CFWClass class = {
.name = "CFWString",
.size = sizeof(CFWString),
.ctor = ctor,
|