From de9551be13b8473d4a1c2a39499cc07e212689c1 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 12 Sep 2024 10:13:23 +0300 Subject: [PATCH] lib/vfs/vfs.c: fix coding style. Signed-off-by: Andrew Borodin --- lib/vfs/vfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/vfs/vfs.c b/lib/vfs/vfs.c index f4dad4649..d931e4ead 100644 --- a/lib/vfs/vfs.c +++ b/lib/vfs/vfs.c @@ -201,10 +201,8 @@ vfs_get_openfile (int handle) return NULL; h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE); - if (h == NULL) - return NULL; - - g_assert (h->handle == handle); + if (h != NULL) + g_assert (h->handle == handle); return h; } @@ -221,7 +219,6 @@ vfs_test_current_dir (const vfs_path_t *vpath) && my_stat.st_ino == my_stat2.st_ino && my_stat.st_dev == my_stat2.st_dev); } - /* --------------------------------------------------------------------------------------------- */ /*** public functions ****************************************************************************/ /* --------------------------------------------------------------------------------------------- */ @@ -243,7 +240,6 @@ vfs_free_handle (int handle) } } - /* --------------------------------------------------------------------------------------------- */ /** Find VFS class by file handle */ @@ -301,7 +297,7 @@ vfs_new_handle (struct vfs_class *vclass, void *fsinfo) int vfs_ferrno (struct vfs_class *vfs) { - return vfs->ferrno ? (*vfs->ferrno) (vfs) : E_UNKNOWN; + return vfs->ferrno != NULL ? vfs->ferrno (vfs) : E_UNKNOWN; /* Hope that error message is obscure enough ;-) */ } @@ -311,7 +307,7 @@ gboolean vfs_register_class (struct vfs_class *vfs) { if (vfs->init != NULL) /* vfs has own initialization function */ - if (!vfs->init (vfs)) /* but it failed */ + if (vfs->init (vfs) == 0) /* but it failed */ return FALSE; g_ptr_array_add (vfs__classes_list, vfs); -- 2.11.4.GIT