lib/vfs/vfs.c: fix coding style.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-09-12 10:13:23 +03:00
parent 54d4dfc534
commit de9551be13

View File

@ -201,10 +201,8 @@ vfs_get_openfile (int handle)
return NULL; return NULL;
h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE); h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE);
if (h == NULL) if (h != NULL)
return NULL; g_assert (h->handle == handle);
g_assert (h->handle == handle);
return h; 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); && my_stat.st_ino == my_stat2.st_ino && my_stat.st_dev == my_stat2.st_dev);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -243,7 +240,6 @@ vfs_free_handle (int handle)
} }
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Find VFS class by file handle */ /** Find VFS class by file handle */
@ -301,7 +297,7 @@ vfs_new_handle (struct vfs_class *vclass, void *fsinfo)
int int
vfs_ferrno (struct vfs_class *vfs) 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 ;-) */ /* Hope that error message is obscure enough ;-) */
} }
@ -311,7 +307,7 @@ gboolean
vfs_register_class (struct vfs_class *vfs) vfs_register_class (struct vfs_class *vfs)
{ {
if (vfs->init != NULL) /* vfs has own initialization function */ 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; return FALSE;
g_ptr_array_add (vfs__classes_list, vfs); g_ptr_array_add (vfs__classes_list, vfs);