[syslinux:elflink] xfs: Do some refactoring

syslinux-bot for Paulo Alcantara pcacjr at zytor.com
Thu Jan 24 09:45:05 PST 2013


Commit-ID:  baea8e0c8625833909ecd51c9cf9b09c70aff639
Gitweb:     http://www.syslinux.org/commit/baea8e0c8625833909ecd51c9cf9b09c70aff639
Author:     Paulo Alcantara <pcacjr at zytor.com>
AuthorDate: Mon, 21 Jan 2013 15:56:48 -0200
Committer:  Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Mon, 21 Jan 2013 15:56:48 -0200

xfs: Do some refactoring

Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>

---
 core/fs/xfs/xfs.c | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c
index 89a9aef..a1826ae 100644
--- a/core/fs/xfs/xfs.c
+++ b/core/fs/xfs/xfs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Paulo Alcantara <pcacjr at zytor.com>
+ * Copyright (c) 2012-2013 Paulo Alcantara <pcacjr at zytor.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -47,20 +47,18 @@ static inline int xfs_fmt_extents_readdir(struct file *file,
 					  struct dirent *dirent,
 					  xfs_dinode_t *core)
 {
-    int retval;
-
     if (be32_to_cpu(core->di_nextents) <= 1) {
 	/* Single-block Directories */
-	retval = xfs_readdir_dir2_block(file, dirent, core);
+	return xfs_readdir_dir2_block(file, dirent, core);
     } else if (xfs_dir2_isleaf(file->fs, core)) {
 	/* Leaf Directory */
-	retval = xfs_readdir_dir2_leaf(file, dirent, core);
+	return xfs_readdir_dir2_leaf(file, dirent, core);
     } else {
 	/* Node Directory */
-	retval = xfs_readdir_dir2_node(file, dirent, core);
+	return xfs_readdir_dir2_node(file, dirent, core);
     }
 
-    return retval;
+    return -1;
 }
 
 static int xfs_readdir(struct file *file, struct dirent *dirent)
@@ -68,7 +66,6 @@ static int xfs_readdir(struct file *file, struct dirent *dirent)
     struct fs_info *fs = file->fs;
     xfs_dinode_t *core;
     struct inode *inode = file->inode;
-    int retval = -1;
 
     core = xfs_dinode_get_core(fs, inode->ino);
     if (!core) {
@@ -77,11 +74,11 @@ static int xfs_readdir(struct file *file, struct dirent *dirent)
     }
 
     if (core->di_format == XFS_DINODE_FMT_LOCAL)
-	retval = xfs_fmt_local_readdir(file, dirent, core);
+	return xfs_fmt_local_readdir(file, dirent, core);
     else if (core->di_format == XFS_DINODE_FMT_EXTENTS)
-	retval = xfs_fmt_extents_readdir(file, dirent, core);
+	return xfs_fmt_extents_readdir(file, dirent, core);
 
-    return retval;
+    return -1;
 }
 
 static uint32_t xfs_getfssec(struct file *file, char *buf, int sectors,
@@ -190,20 +187,18 @@ static inline struct inode *xfs_fmt_extents_find_entry(const char *dname,
 						       struct inode *parent,
 						       xfs_dinode_t *core)
 {
-    struct inode *inode;
-
     if (be32_to_cpu(core->di_nextents) <= 1) {
-        /* Single-block Directories */
-        inode = xfs_dir2_block_find_entry(dname, parent, core);
+	/* Single-block Directories */
+	return xfs_dir2_block_find_entry(dname, parent, core);
     } else if (xfs_dir2_isleaf(parent->fs, core)) {
-        /* Leaf Directory */
-	inode = xfs_dir2_leaf_find_entry(dname, parent, core);
+	/* Leaf Directory */
+	return xfs_dir2_leaf_find_entry(dname, parent, core);
     } else {
-        /* Node Directory */
-        inode = xfs_dir2_node_find_entry(dname, parent, core);
+	/* Node Directory */
+	return xfs_dir2_node_find_entry(dname, parent, core);
     }
 
-    return inode;
+    return NULL;
 }
 
 static inline struct inode *xfs_fmt_btree_find_entry(const char *dname,


More information about the Syslinux-commits mailing list