aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src/get_line.c
AgeCommit message (Collapse)Author
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>