Skip to content

Commit 10a0883

Browse files
committed
Moved lfs_mdir_isopen behind LFS_NO_ASSERT
lfs_mdir_isopen goes unused if asserts are disabled, and this caused an "unused function" warning on Clang (curiously not on GCC since the function was static inline, commonly used for header-only functions). Also removed "inline" from the lfs_mdir_* functions as these involve linked-list operations and really shouldn't be inlined. And since they are static, inlining should occur automatically if there is a benefit. Found by dpgeorge
1 parent 1a59954 commit 10a0883

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lfs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ static inline void lfs_superblock_tole32(lfs_superblock_t *superblock) {
425425
superblock->attr_max = lfs_tole32(superblock->attr_max);
426426
}
427427

428-
static inline bool lfs_mlist_isopen(struct lfs_mlist *head,
428+
#ifndef LFS_NO_ASSERT
429+
static bool lfs_mlist_isopen(struct lfs_mlist *head,
429430
struct lfs_mlist *node) {
430431
for (struct lfs_mlist **p = &head; *p; p = &(*p)->next) {
431432
if (*p == (struct lfs_mlist*)node) {
@@ -435,8 +436,9 @@ static inline bool lfs_mlist_isopen(struct lfs_mlist *head,
435436

436437
return false;
437438
}
439+
#endif
438440

439-
static inline void lfs_mlist_remove(lfs_t *lfs, struct lfs_mlist *mlist) {
441+
static void lfs_mlist_remove(lfs_t *lfs, struct lfs_mlist *mlist) {
440442
for (struct lfs_mlist **p = &lfs->mlist; *p; p = &(*p)->next) {
441443
if (*p == mlist) {
442444
*p = (*p)->next;
@@ -445,7 +447,7 @@ static inline void lfs_mlist_remove(lfs_t *lfs, struct lfs_mlist *mlist) {
445447
}
446448
}
447449

448-
static inline void lfs_mlist_append(lfs_t *lfs, struct lfs_mlist *mlist) {
450+
static void lfs_mlist_append(lfs_t *lfs, struct lfs_mlist *mlist) {
449451
mlist->next = lfs->mlist;
450452
lfs->mlist = mlist;
451453
}

0 commit comments

Comments
 (0)