]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Use fread_unlocked
authorTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 17 Oct 2024 08:09:34 +0000 (10:09 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 29 Oct 2024 02:50:14 +0000 (21:50 -0500)
This is in sync with read_char, which uses getc_unlocked. This and
previous FILE based index adjustments improved FILE based index dump
performance by 8 %.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/190
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-index.c

index 64a38979eee9b89a7e443c63ae1b3f6eb0f4cb0f..2ed8752d8cba97ecbc1d07ecf7701b3c48f5360c 100644 (file)
@@ -183,7 +183,7 @@ static bool read_u32s(FILE *in, uint32_t *l, size_t n)
        size_t i;
 
        errno = 0;
-       if (fread(l, sizeof(uint32_t), n, in) != n) {
+       if (fread_unlocked(l, sizeof(uint32_t), n, in) != n) {
                errno = EINVAL;
                return false;
        }