[Sheepdog] PATCH S005: Improve type safety in node_cmp calls

Shevek shevek at anarres.org
Thu May 3 07:00:32 CEST 2012


On Thu, 2012-05-03 at 13:41 +0900, MORITA Kazutaka wrote:
> At Thu, 03 May 2012 10:25:07 +0800,
> Liu Yuan wrote:
> > 
> > On 05/03/2012 05:56 AM, Shevek wrote:
> > 
> > > This makes calls to node_cmp() == 0 typesafe under C99.
> > > 
> > > I wanted to write this for a while. Now I finally did it.
> > > 
> > > S.
> > > 
> > 
> > 
> > I'd suggest we'd better directly code node_cmp() typesafe rather than
> > write a wrapper on top of it. I like the idea let node_cmp() return 1
> 
> node_cmp() is also used for qsort()/bsearch(), so we cannot change its
> arguments or return value.  I think this patch looks okay if it is
> against the current git master.

Yes, that is exactly why I did it this way. I tried other solutions, but
this was the most elegant.

> > for equality to eliminate '== 0', so I'd suggest a name as node_equal(),
> > which returns 1 for equality.
> > 
> > As other commented, you'd better use git format to generate the patch
> > and mail it as the text body.
> 
> We should document the rule.  I've added it to Sheepdog wiki:
>   https://github.com/collie/sheepdog/wiki/Submit-a-patch

Even more useful would be a set of commands, rather than just using
'git diff > file'.

Thank you.

S.




More information about the sheepdog mailing list