char *i_stream_read_next_line(struct istream *stream) { char *line; for (;;) { line = i_stream_next_line(stream); if (line != NULL) break; switch (i_stream_read(stream)) { case -2: io_stream_set_error(&stream->real_stream->iostream, "Line is too long (over %"PRIuSIZE_T " bytes at offset %"PRIuUOFF_T")", i_stream_get_data_size(stream), stream->v_offset); stream->stream_errno = errno = ENOBUFS; stream->eof = TRUE; return NULL; case -1: return i_stream_last_line(stream->real_stream); case 0: return NULL; } } return line; }
char *i_stream_next_line(struct istream *stream) { struct istream_private *_stream = stream->real_stream; const unsigned char *pos; if (_stream->skip >= _stream->pos) return NULL; pos = memchr(_stream->buffer + _stream->skip, '\n', _stream->pos - _stream->skip); if (pos != NULL) { return i_stream_next_line_finish(_stream, pos - _stream->buffer); } else { return i_stream_last_line(_stream); } }
char *i_stream_read_next_line(struct istream *stream) { char *line; for (;;) { line = i_stream_next_line(stream); if (line != NULL) break; switch (i_stream_read(stream)) { case -2: stream->stream_errno = ENOBUFS; stream->eof = TRUE; return NULL; case -1: return i_stream_last_line(stream->real_stream); case 0: return NULL; } } return line; }