From: Huang Jianan <[email protected]>

Signed-off-by: Huang Jianan <[email protected]>
---
 fuse/main.c                | 5 +----
 include/erofs/block_list.h | 4 ++--
 lib/block_list.c           | 5 +----
 lib/compress.c             | 9 ++++-----
 lib/compressor.c           | 2 +-
 lib/namei.c                | 3 ++-
 lib/xattr.c                | 2 +-
 mkfs/main.c                | 2 +-
 8 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/fuse/main.c b/fuse/main.c
index 34a9b7a..197943a 100644
--- a/fuse/main.c
+++ b/fuse/main.c
@@ -109,16 +109,13 @@ static struct options {
        bool odebug;
 } fusecfg;
 
-#define OPTION(t, p)                           \
-    { t, offsetof(struct options, p), 1 }
+#define OPTION(t, p) { t, offsetof(struct options, p), 1 }
 static const struct fuse_opt option_spec[] = {
        OPTION("--dbglevel=%u", debug_lvl),
        OPTION("--help", show_help),
        FUSE_OPT_END
 };
 
-#define OPTION(t, p)    { t, offsetof(struct options, p), 1 }
-
 static void usage(void)
 {
        struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
diff --git a/include/erofs/block_list.h b/include/erofs/block_list.h
index fca476a..dcc0e50 100644
--- a/include/erofs/block_list.h
+++ b/include/erofs/block_list.h
@@ -18,8 +18,8 @@ void erofs_droid_blocklist_write_tail_end(struct erofs_inode 
*inode,
 #else
 static inline void erofs_droid_blocklist_write(struct erofs_inode *inode,
                                 erofs_blk_t blk_start, erofs_blk_t nblocks) {}
-static inline
-void erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
+static inline void
+erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
                                          erofs_blk_t blkaddr) {}
 #endif
 #endif
diff --git a/lib/block_list.c b/lib/block_list.c
index 73c1bde..15bb5cf 100644
--- a/lib/block_list.c
+++ b/lib/block_list.c
@@ -11,13 +11,10 @@
 #define pr_fmt(fmt) "EROFS block_list: " FUNC_LINE_FMT fmt "\n"
 #include "erofs/print.h"
 
-static FILE *block_list_fp = NULL;
+static FILE *block_list_fp;
 
 int erofs_droid_blocklist_fopen(void)
 {
-       if (block_list_fp)
-               return 0;
-
        block_list_fp = fopen(cfg.block_list_file, "w");
 
        if (!block_list_fp)
diff --git a/lib/compress.c b/lib/compress.c
index 2b12d67..0530765 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -292,13 +292,12 @@ static void *write_compacted_indexes(u8 *out,
        bool update_blkaddr;
        erofs_blk_t blkaddr;
 
-       if (destsize == 4) {
+       if (destsize == 4)
                vcnt = 2;
-       } else if (destsize == 2 && logical_clusterbits == 12) {
+       else if (destsize == 2 && logical_clusterbits == 12)
                vcnt = 16;
-       } else {
+       else
                return ERR_PTR(-EINVAL);
-       }
        encodebits = (vcnt * destsize * 8 - 32) / vcnt;
        blkaddr = *blkaddr_ret;
        update_blkaddr = erofs_sb_has_big_pcluster();
@@ -467,8 +466,8 @@ int erofs_write_compressed_file(struct erofs_inode *inode)
        erofs_blk_t blkaddr, compressed_blocks;
        unsigned int legacymetasize;
        int ret, fd;
-
        u8 *compressmeta = malloc(vle_compressmeta_capacity(inode->i_size));
+
        if (!compressmeta)
                return -ENOMEM;
 
diff --git a/lib/compressor.c b/lib/compressor.c
index 846a836..6bc5c4c 100644
--- a/lib/compressor.c
+++ b/lib/compressor.c
@@ -26,7 +26,7 @@ int erofs_compress_destsize(struct erofs_compress *c,
                            void *dst,
                            unsigned int dstsize)
 {
-       unsigned uncompressed_size;
+       unsigned int uncompressed_size;
        int ret;
 
        DBG_BUGON(!c->alg);
diff --git a/lib/namei.c b/lib/namei.c
index f4094a1..54c368a 100644
--- a/lib/namei.c
+++ b/lib/namei.c
@@ -243,7 +243,8 @@ static int link_path_walk(const char *name, struct 
nameidata *nd)
 
                name = p;
                /* Skip until no more slashes. */
-               for (name = p; *name == '/'; ++name);
+               for (name = p; *name == '/'; ++name)
+                       ;
        }
        return 0;
 }
diff --git a/lib/xattr.c b/lib/xattr.c
index 39d4a96..821e6c9 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -215,7 +215,7 @@ static struct xattr_item *erofs_get_selabel_xattr(const 
char *srcpath,
                                       erofs_fspath(srcpath));
                else
 #endif
-               ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
+                       ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
                if (ret <= 0)
                        return ERR_PTR(-ENOMEM);
 
diff --git a/mkfs/main.c b/mkfs/main.c
index debb754..40ca94f 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -174,7 +174,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
        char *endptr;
        int opt, i;
 
-       while((opt = getopt_long(argc, argv, "d:x:z:E:T:U:C:",
+       while ((opt = getopt_long(argc, argv, "d:x:z:E:T:U:C:",
                                 long_options, NULL)) != -1) {
                switch (opt) {
                case 'z':
-- 
2.25.1

Reply via email to