From: Eric Sandeen <sandeen@redhat.com>
To: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_quota: drop pointless qsort cmp casting
Date: Tue, 2 Feb 2021 13:08:31 -0600 [thread overview]
Message-ID: <85f43472-5341-b979-3c7b-7e49a6ba0ce4@redhat.com> (raw)
The function cast in this call to qsort is odd - we don't do it
anywhere else, and it doesn't gain us anything or help in any
way.
So remove it; since we are now passing void *p pointers in, locally
use du_t *d pointers to refer to the du_t's in the compare function.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/quota/quot.c b/quota/quot.c
index 8544aef6..9e8086c4 100644
--- a/quota/quot.c
+++ b/quota/quot.c
@@ -173,16 +173,19 @@ quot_bulkstat_mount(
static int
qcompare(
- du_t *p1,
- du_t *p2)
+ const void *p1,
+ const void *p2)
{
- if (p1->blocks > p2->blocks)
+ du_t *d1 = (struct du *)p1;
+ du_t *d2 = (struct du *)p2;
+
+ if (d1->blocks > d2->blocks)
return -1;
- if (p1->blocks < p2->blocks)
+ if (d1->blocks < d2->blocks)
return 1;
- if (p1->id > p2->id)
+ if (d1->id > d2->id)
return 1;
- else if (p1->id < p2->id)
+ else if (d1->id < d2->id)
return -1;
return 0;
}
@@ -204,8 +207,7 @@ quot_report_mount_any_type(
fprintf(fp, _("%s (%s) %s:\n"),
mount->fs_name, mount->fs_dir, type_to_string(type));
- qsort(dp, count, sizeof(dp[0]),
- (int (*)(const void *, const void *))qcompare);
+ qsort(dp, count, sizeof(dp[0]), qcompare);
for (; dp < &dp[count]; dp++) {
if (dp->blocks == 0)
return;
next reply other threads:[~2021-02-02 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 19:08 Eric Sandeen [this message]
2021-02-02 19:16 ` [PATCH] xfs_quota: drop pointless qsort cmp casting Darrick J. Wong
2021-02-02 19:16 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85f43472-5341-b979-3c7b-7e49a6ba0ce4@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.