diff mbox series

[2/2] xfsprogs: xfs_fsr: Limit the scope of cmp()

Message ID 20210125095809.219833-2-chandanrlinux@gmail.com (mailing list archive)
State Superseded, archived
Headers show
Series [1/2] xfsprogs: xfs_fsr: Interpret arguments of qsort's compare function correctly | expand

Commit Message

Chandan Babu R Jan. 25, 2021, 9:58 a.m. UTC
cmp() function is being referred to by only from within fsr/xfs_fsr.c. Hence
this commit limits its scope to the current file.

Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
 fsr/xfs_fsr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Sandeen Jan. 25, 2021, 2:19 p.m. UTC | #1
On 1/25/21 3:58 AM, Chandan Babu R wrote:
> cmp() function is being referred to by only from within fsr/xfs_fsr.c. Hence
> this commit limits its scope to the current file.
> 
> Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>

Might be nice to move cmp just ahead of fsrfs() so we don't need the
forward declaration but *shrug*

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  fsr/xfs_fsr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
> index 635e4c70..2d070320 100644
> --- a/fsr/xfs_fsr.c
> +++ b/fsr/xfs_fsr.c
> @@ -81,7 +81,7 @@ char * gettmpname(char *fname);
>  char * getparent(char *fname);
>  int fsrprintf(const char *fmt, ...);
>  int read_fd_bmap(int, struct xfs_bstat *, int *);
> -int cmp(const void *, const void *);
> +static int cmp(const void *, const void *);
>  static void tmp_init(char *mnt);
>  static char * tmp_next(char *mnt);
>  static void tmp_close(char *mnt);
> @@ -699,7 +699,7 @@ out0:
>  /*
>   * To compare bstat structs for qsort.
>   */
> -int
> +static int
>  cmp(const void *s1, const void *s2)
>  {
>  	return( ((struct xfs_bulkstat *)s2)->bs_extents -
>
diff mbox series

Patch

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 635e4c70..2d070320 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -81,7 +81,7 @@  char * gettmpname(char *fname);
 char * getparent(char *fname);
 int fsrprintf(const char *fmt, ...);
 int read_fd_bmap(int, struct xfs_bstat *, int *);
-int cmp(const void *, const void *);
+static int cmp(const void *, const void *);
 static void tmp_init(char *mnt);
 static char * tmp_next(char *mnt);
 static void tmp_close(char *mnt);
@@ -699,7 +699,7 @@  out0:
 /*
  * To compare bstat structs for qsort.
  */
-int
+static int
 cmp(const void *s1, const void *s2)
 {
 	return( ((struct xfs_bulkstat *)s2)->bs_extents -