Fix non-POSIX get_line

This commit is contained in:
ado 2024-02-25 10:53:21 +01:00
parent f2ff40a625
commit f4a06d40e7

View File

@ -55,7 +55,7 @@ ssize_t get_line_file(char** lineptr, size_t* n, FILE* fp) {
if (*lineptr == nullptr || *n < sizeof(buff)) {
size_t new_n = sizeof(buff);
lineptr = static_cast<char*>(strict_realloc(*lineptr, new_n));
*lineptr = static_cast<char*>(strict_realloc(*lineptr, new_n));
*n = new_n;
}
@ -69,7 +69,7 @@ ssize_t get_line_file(char** lineptr, size_t* n, FILE* fp) {
if (*n <= buff_used + line_used) {
size_t new_n = *n * 2;
lineptr = static_cast<char*>(realloc(*lineptr, new_n));
*lineptr = static_cast<char*>(strict_realloc(*lineptr, new_n));
*n = new_n;
}