From a6fa8e8e0d6b86c669ac2fb2b7be44812604c21f Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 20 Apr 2020 15:42:01 +0200 Subject: [PATCH] Remove unneeded file_getline() Not needed anymore since 0942d98c6116dc4b9b608e7483f1d6a8f62c84d7 --- src/common.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/common.c b/src/common.c index 31194352..d06307cb 100644 --- a/src/common.c +++ b/src/common.c @@ -226,50 +226,6 @@ utf8_display_len(const char *const str) return len; } -char* -file_getline(FILE *stream) -{ - char *buf; - char *result; - char *s = NULL; - size_t s_size = 1; - int need_exit = 0; - - buf = (char *)malloc(READ_BUF_SIZE); - - while (TRUE) { - result = fgets(buf, READ_BUF_SIZE, stream); - if (result == NULL) - break; - size_t buf_size = strlen(buf); - if (buf[buf_size - 1] == '\n') { - buf_size--; - buf[buf_size] = '\0'; - need_exit = 1; - } - - result = (char *)realloc(s, s_size + buf_size); - if (result == NULL) { - if (s) { - free(s); - s = NULL; - } - break; - } - s = result; - - memcpy(s + s_size - 1, buf, buf_size); - s_size += buf_size; - s[s_size - 1] = '\0'; - - if (need_exit != 0 || feof(stream) != 0) - break; - } - - free(buf); - return s; -} - char* release_get_latest(void) {