- va_start(argv, argc);
- for (i = 0; i < argc; ++i) {
- char *str = va_arg(argv, char *);
- size_t str_len = strlen(str), token_len = T->size, fname_len = strlen(T->file);
-
- T = realloc(T, psi_token_alloc_size(T->size += str_len + sep_len, fname_len));
- T->text = &T->buf[0];
- T->file = &T->buf[T->size + 1];
- memmove(&T->buf[T->size + 1], &T->buf[token_len + 1], fname_len + 1);
- memcpy(&T->buf[token_len], sep, sep_len);
- memcpy(&T->buf[token_len + sep_len], str, str_len + 1);
+ smart_str_appendl_ex(&text, str, str_len, 1);