1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-04 23:46:44 +02:00

more succinct way to get file sizes

This commit is contained in:
Jfreegman
2014-09-24 00:06:02 -04:00
parent b071a9e992
commit 893e88294b
6 changed files with 18 additions and 43 deletions

View File

@ -181,23 +181,13 @@ int load_blocklist(char *path)
if (fp == NULL)
return -1;
if (fseek(fp, 0L, SEEK_END) == -1) {
fclose(fp);
return -1;
}
int len = ftell(fp);
uint64_t len = file_size(path);
if (len == -1) {
fclose(fp);
return -1;
}
if (fseek(fp, 0L, SEEK_SET) == -1) {
fclose(fp);
return -1;
}
char *data = malloc(len);
if (data == NULL) {