Re: Bug#14412: g_list_find_custom inconsistent with GCompareFunc



On Thu, 26 Oct 2000, Sebastian Wilhelmi wrote:

> Hi John,
> 
> > Description:
> > The glib API says of g_list_find_custom, "It iterates over the list,
> > calling the given function which should return 0 when the desired
> > element is found.
> 
> That has also bugged me for a while. So I introduced another Function Type: 
> 
> typedef gboolean (*GEqualFunc) (gconstpointer  a, gconstpointer  b);
> 
> That allows us to differentiate the (so far) two meanings of GCompareFunc at
> the API level. a GCompareFunc works like strcmp and a GEqualFunc returns TRUE
> for equal values. I havn't yet updated the Documentation, but I'll do that,
> when I'm going to commit.
> 
> If no-one objects, I'll commit the attached patch next week. Note, that this
> won't break any code, as gint and gboolean are the same.

please go ahead and on the way check other usages of *compare* as well.
basically, "compare" should return results, and be only used in contexts,
where something like this is desired:

/* helper macro to avoid signed overflow for value comparisions */
#define G_BSEARCH_ARRAY_CMP(v1,v2) ((v1) < (v2) ? -1 : (v1) > (v2) ? 1 : 0)


[META: when will the bugtracker deal with multiple To: adresses?]

> 
> Bye,
> Sebastian
> -- 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]