unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp.
@ 2009-11-22 12:32 Jan Janak
  2009-11-23  2:38 ` Carl Worth
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Janak @ 2009-11-22 12:32 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp.
  2009-11-22 12:32 [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp Jan Janak
@ 2009-11-23  2:38 ` Carl Worth
  2009-11-23  2:47   ` Jan Janak
  0 siblings, 1 reply; 3+ messages in thread
From: Carl Worth @ 2009-11-23  2:38 UTC (permalink / raw)
  To: Jan Janak, notmuch

On Sun, 22 Nov 2009 13:32:36 +0100, Jan Janak <jan@ryngle.com> wrote:
> 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.

Actually, on my system at least, (Linux with glibc 2.10.1), our current
function matches the prototype. So applying your patch actually
*introduces* a warning where there was no warning before.

What a nuisance...

Any ideas for a good fix, anyone?

-Carl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp.
  2009-11-23  2:38 ` Carl Worth
@ 2009-11-23  2:47   ` Jan Janak
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Janak @ 2009-11-23  2:47 UTC (permalink / raw)
  To: Carl Worth; +Cc: notmuch

On Mon, Nov 23, 2009 at 3:38 AM, Carl Worth <cworth@cworth.org> wrote:
> On Sun, 22 Nov 2009 13:32:36 +0100, Jan Janak <jan@ryngle.com> wrote:
>> 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.
>
> Actually, on my system at least, (Linux with glibc 2.10.1), our current
> function matches the prototype. So applying your patch actually
> *introduces* a warning where there was no warning before.
>
> What a nuisance...
>
> Any ideas for a good fix, anyone?

OK, I have an older version of glibc. If the original code works with
glibc 2.10 then just ignore the patch. I think testing for a
particular version of glibc is not worth the effort (it's just a
warning anyway).

  -- Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-23  2:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-22 12:32 [PATCH] notmuch-new: Eliminate gcc warning caused by ino_cmp Jan Janak
2009-11-23  2:38 ` Carl Worth
2009-11-23  2:47   ` Jan Janak

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).