[notmuch] [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp.

Subject: [notmuch] [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp.

Date: Sun, 22 Nov 2009 13:32:36 +0100

To: notmuch@notmuchmail.org

Cc:

From: Jan Janak


The function passed to scandir in the fourth argument takes two
const void* arguments. To eliminate the gcc warning about incompatible
types, we change ino_cmp to match this and then re-type the parameters
in the body of ino_cmp.

Signed-off-by: Jan Janak <jan@ryngle.com>
---
 notmuch-new.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 0dd2784..6db3d0f 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -75,9 +75,10 @@ add_files_print_progress (add_files_state_t *state)
     fflush (stdout);
 }
 
-static int ino_cmp(const struct dirent **a, const struct dirent **b)
+static int ino_cmp(const void *a, const void *b)
 {
-    return ((*a)->d_ino < (*b)->d_ino) ? -1 : 1;
+    return ((*(const struct dirent**)a)->d_ino <
+	    (*(const struct dirent**)b)->d_ino) ? -1 : 1;
 }
 
 /* Examine 'path' recursively as follows:
-- 
1.6.3.3


Thread: