mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 09:26:00 +01:00
use BUFSIZ
This commit is contained in:
parent
7ca688a964
commit
c06a1a4df7
1 changed files with 2 additions and 3 deletions
|
@ -164,15 +164,14 @@ guess_type(const char* path)
|
|||
}
|
||||
|
||||
const int fd = fileno(f);
|
||||
static const size_t BLKSIZE = 4096;
|
||||
guchar* content = NULL;
|
||||
size_t length = 0u;
|
||||
while (uncertain == TRUE) {
|
||||
g_free((void*)content_type);
|
||||
content_type = NULL;
|
||||
|
||||
content = g_realloc(content, length + BLKSIZE);
|
||||
const ssize_t r = read(fd, content + length, BLKSIZE);
|
||||
content = g_realloc(content, length + BUFSIZ);
|
||||
const ssize_t r = read(fd, content + length, BUFSIZ);
|
||||
if (r == -1) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue