After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 164271 - Searching in the list with asymmetric function
Searching in the list with asymmetric function
Status: RESOLVED NOTABUG
Product: glib
Classification: Platform
Component: docs
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-01-16 18:51 UTC by Sebastien Bacher
Modified: 2005-01-17 03:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastien Bacher 2005-01-16 18:51:20 UTC
This bug has been opened here: http://bugs.debian.org/207042

"For g_list_find_custom() and g_slist_find_custom() it is not documented whether
"func" is called with "data" as first or as second argument (and with the other
argument of "func" being a value from "list").

Please document it. It matters for asymmetric comparison functions like the
following:

#inlcude <sys/stat.h>
static gint
greek_word_clicked_morph_compare(gconstpointer a, gconstpointer b)
{
  int x = (struct stat*)a->st_atime;
  int y = (struct stat*)b->st_mtime;

  if(x == y) return 0;
  return x > y ? 1 : -1;
}

Note asymmetry: "atime" for the left arg, but "mtime" for the right one."
Comment 1 Matthias Clasen 2005-01-17 03:43:26 UTC
I'm not sure what you are missing, the docs say:

The function takes two #gconstpointer arguments, the #GList element's data
and the given user data