* \param line_handler The custom function.
* \param private_data Pointer passed to \a line_handler.
*
- * If \p line_handler is \p NULL, the function returns the number of complete
- * lines in \p buf.
- *
- * Otherwise, \p line_handler is called for each complete line in \p buf. The
- * first argument to \p line_handler is (a copy of) the current line, and \p
+ * For each complete line in \p buf, \p line_handler is called. The first
+ * argument to \p line_handler is (a copy of) the current line, and \p
* private_data is passed as the second argument. If the \p FELF_READ_ONLY
* flag is unset, a pointer into \a buf is passed to the line handler,
- * otherwise a pointer to a copy of each line is passed instead. This copy is
- * freed immediately after the line handler returns.
+ * otherwise a pointer to a copy of the current line is passed instead. This
+ * copy is freed immediately after the line handler returns.
*
* The function returns if \p line_handler returns a negative value or no more
* lines are in the buffer. The rest of the buffer (last chunk containing an
* incomplete line) is moved to the beginning of the buffer if FELF_READ_ONLY is
* unset.
*
- * \return If \p line_handler is not \p NULL and FELF_READ_ONLY is not set,
- * this function returns the number of bytes not handled to \p line_handler,
- * otherwise number of complete lines. On errors the negative error code of
- * the \p line_handler is returned.
+ * \return If \p FELF_READ_ONLY is not set in \a flags, this function returns
+ * the number of bytes not handled to \p line_handler, otherwise the number of
+ * complete lines. On errors the negative error code of the \p line_handler is
+ * returned.
*
* \sa \ref for_each_line_flags.
*/
} else
end = next_cr;
num_lines++;
- if (!line_handler) {
- start = ++end;
- continue;
- }
if (flags & FELF_READ_ONLY) {
size_t s = end - start;
char *b = para_malloc(s + 1);
return ret;
start = ++end;
}
- if (!line_handler || (flags & FELF_READ_ONLY))
+ if (flags & FELF_READ_ONLY)
return num_lines;
i = buf + size - start;
if (i && i != size)