215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
str->len = len;
}
bool
cfw_string_append(CFWString *str, CFWString *append)
{
char *new;
if ((new = realloc(str->data, str->len + append->len + 1)) == NULL)
return false;
memcpy(new + str->len, append->data, append->len);
new[str->len + append->len] = 0;
str->data = new;
str->len += append->len;
return true;
}
bool
cfw_string_append_c(CFWString *str, const char *append)
{
size_t append_len = strlen(append);
char *new;
if ((new = realloc(str->data, str->len + append_len + 1)) == NULL)
return false;
memcpy(new + str->len, append, append_len);
new[str->len + append_len] = 0;
|
>
>
>
>
|
|
>
>
>
>
|
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
str->len = len;
}
bool
cfw_string_append(CFWString *str, CFWString *append)
{
char *new;
if (append == NULL)
return true;
if ((new = realloc(str->data, str->len + append->len + 1)) == NULL)
return false;
memcpy(new + str->len, append->data, append->len);
new[str->len + append->len] = 0;
str->data = new;
str->len += append->len;
return true;
}
bool
cfw_string_append_c(CFWString *str, const char *append)
{
char *new;
size_t append_len;
if (append == NULL)
return true;
append_len = strlen(append);
if ((new = realloc(str->data, str->len + append_len + 1)) == NULL)
return false;
memcpy(new + str->len, append, append_len);
new[str->len + append_len] = 0;
|