1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Remove unneeded file_getline()

Not needed anymore since 0942d98c61
This commit is contained in:
Michael Vetter 2020-04-20 15:42:01 +02:00
parent 9e460973fa
commit a6fa8e8e0d

View File

@ -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)
{