Skip to content

Commit

Permalink
chore: fix modern clang errors.
Browse files Browse the repository at this point in the history
Unused variable ext_written was reported by -Wunused-but-set-variable,
so it's now guarded by the same preprocessor guards that protects its
actual usage.

Function without prototypes are note allowed in C23.
  • Loading branch information
qkaiser committed Feb 13, 2024
1 parent 6303c42 commit 647f364
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 8 additions & 1 deletion e2fsck/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
{
errcode_t retval;
ext2_extent_handle_t handle;
unsigned int i, ext_written;
unsigned int i;
struct ext2fs_extent *ex, extent;
blk64_t start_val, delta;
#if defined(DEBUG) || defined(DEBUG_SUMMARY)
unsigned int ext_written;
#endif

/* Reset extent tree */
inode->i_flags &= ~EXT4_EXTENTS_FL;
Expand All @@ -223,7 +226,9 @@ static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
if (retval)
return retval;

#if defined(DEBUG) || defined(DEBUG_SUMMARY)
ext_written = 0;
#endif

start_val = ext2fs_get_stat_i_blocks(ctx->fs, EXT2_INODE(inode));

Expand Down Expand Up @@ -263,7 +268,9 @@ static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
retval = ext2fs_extent_fix_parents(handle);
if (retval)
goto err;
#if defined(DEBUG) || defined(DEBUG_SUMMARY)
ext_written++;
#endif
}

delta = ext2fs_get_stat_i_blocks(ctx->fs, EXT2_INODE(inode)) -
Expand Down
4 changes: 1 addition & 3 deletions lib/ss/test_ss.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ int main(int argc, char **argv)
}


void test_cmd (argc, argv)
int argc;
char **argv;
void test_cmd (int argc, char** argv)
{
printf("Hello, world!\n");
printf("Args: ");
Expand Down

0 comments on commit 647f364

Please sign in to comment.