No caller used this function for counting lines, so simplify it by always
returning the number of bytes not processed.
* incomplete line) is moved to the beginning of the buffer if FELF_READ_ONLY is
* unset.
*
* incomplete line) is moved to the beginning of the buffer if FELF_READ_ONLY is
* unset.
*
- * \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.
+ * \return On success this function returns the number of bytes not handled to
+ * \p line_handler. The only possible error is a negative return value from the
+ * line handler. In this case processing stops and the return value of the line
+ * handler is returned to indicate failure.
*
* \sa \ref for_each_line_flags.
*/
*
* \sa \ref for_each_line_flags.
*/
return ret;
start = ++end;
}
return ret;
start = ++end;
}
- if (flags & FELF_READ_ONLY)
- return num_lines;
+ if (i && i != size && !(flags & FELF_READ_ONLY))
memmove(buf, start, i);
return i;
}
memmove(buf, start, i);
return i;
}