From 0e0be76c582a4770d6d72fbf4caa97f2e73098d5 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 23 Aug 2022 13:04:16 +0000 Subject: [PATCH] database: Encourage the compiler to inline some functions Signed-off-by: Michael Tremer --- src/database.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/database.c b/src/database.c index 311f4ab..106cede 100644 --- a/src/database.c +++ b/src/database.c @@ -148,7 +148,7 @@ struct loc_database_enumerator { #define loc_database_check_boundaries(db, p) \ __loc_database_check_boundaries(db, (const char*)p, sizeof(*p)) -static int __loc_database_check_boundaries(struct loc_database* db, +static inline int __loc_database_check_boundaries(struct loc_database* db, const char* p, const size_t length) { size_t offset = p - db->data; @@ -170,14 +170,8 @@ static int __loc_database_check_boundaries(struct loc_database* db, /* Returns a pointer to the n-th object */ -static char* loc_database_object(struct loc_database* db, +static inline char* loc_database_object(struct loc_database* db, const struct loc_database_objects* objects, const size_t length, const off_t n) { - // Return NULL if objects were not initialized - if (!objects->data) { - errno = EFAULT; - return NULL; - } - // Calculate offset const off_t offset = n * length; -- 2.39.5