Collin Funk <[email protected]> writes:
> if (MB_CUR_MAX <= 1)
> + {
> + do
> + {
> + char *start = ptr + strspn (ptr, "\n\t ");
> + char *end = start + strcspn (start, "\n\t ");
> + idx_t const len = end - start;
> + if (0 < len)
> + extract_field (line, start, len);
> + ptr = end + (ptr < lim);
> + }
> + while (ptr < lim);
> + }
Oops, I rewrote the patch to simplify it a bit. In the process I forgot
to add the null terminator, since the line buffer doesn't do that for
us. It would be something like this:
if (MB_CUR_MAX <= 1)
{
line->buf.buffer[line->buf.length - 1] = '\0';
do
{
char *start = ptr + strspn (ptr, "\n\t ");
char *end = start + strcspn (start, "\n\t ");
idx_t const len = end - start;
if (0 < len)
extract_field (line, start, len);
ptr = end + (ptr < lim);
}
while (ptr < lim);
line->buf.buffer[line->buf.length - 1] = eolchar;
}