[ofw] Re: [PATCH] osm_subnet.c

Sasha Khapyorsky sashak at voltaire.com
Thu Nov 12 11:18:11 PST 2009


On 09:20 Mon 05 Oct     , Sean Hefty wrote:
> >>  /**********************************************************************
> >>   **********************************************************************/
> >> -static long compar_mgids(const void *m1, const void *m2)
> >> +static intn_t compar_mgids(const void *m1, const void *m2)
> >
> >Any disagreement about changing a prototype of this method
> >(cl_pfn_fmap_cmp_t) in complib to use standard type (long) instead of
> >"homemade" and less clear one ('intn_t')?
> >
> >Sasha
> >
> >>  {
> >>         return memcmp(m1, m2, sizeof(ib_gid_t));
> >>  }
> 
> If the function is simply a wrapper around a single call to memcmp, why keep it
> at all?

The function is used as comparator callback in complib's fleximap
implementation (just similar to qsort()'s compar parameter and others)
and signed integer (= , >  or < 0) should be returned. Using pointer
sized int as return value is not needed here. We can do it to match
others comparators (qsort, scandir, etc.) prototype exactly:

	int compar(const void *, const void *);

, or to not bother at all and leave it as 'long'.

Hmm, I would prefer to change to 'int' to prevent future confusing.
Thoughts?

Sasha



More information about the ofw mailing list