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:
@ -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) {
|
||||
|
Reference in New Issue
Block a user