aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src/get_line.c
AgeCommit message (Collapse)Author
2023-06-11libio: remove precache from istream_advance_bufferDavid Oberhollenzer
Since the user has to call istream_get_buffered_data afterwards anyway, we can do the precache lazily. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-10libio: add desired read size to istream_get_buffered_dataDavid Oberhollenzer
This properly maps to all of our use cases and makes istream_precache obsolete. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-09libio: eliminate direct access of the interal bufferDavid Oberhollenzer
Instead, go through helper functions, which in a next step can be moved inside the implementation. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-05libio: istream_get_line: minor cleanupDavid Oberhollenzer
Remove redundant initializations, reduce variable scope. At exist of the function, try to shrink the buffer to the actual size if it got trimmed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-05libio: istream_get_line: fix memory leak in error pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-05libio: istream_get_line: fix trailing CR sanitationDavid Oberhollenzer
The istream_get_line function is supposed to remove the line break, inclduing CR+LF if used. The previous implementation simply checked the buffer when the LF was found, missing the case where the CR was alraedy added and the LF is at the beginning of the newly loaded data. This commit modifies the check to inspect the line itself when it was found, and remove the CR after the fact. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-05libio: remove buffer_offset from istream_tDavid Oberhollenzer
Instead, make the buffer const, let the user adjust the pointer and size. The offset can then be inferred in precache. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-31Move library source into src sub-directoryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>