From 0cf234eebea05fbc8de45d44e0aadef1cff0d20e Mon Sep 17 00:00:00 2001 From: edgrif <edgrif> Date: Mon, 2 Oct 2006 15:12:41 +0000 Subject: [PATCH] add trivial function to find a quark in a glist... --- src/include/ZMap/zmapGLibUtils.h | 8 ++++---- src/zmapUtils/zmapGLibUtils.c | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/include/ZMap/zmapGLibUtils.h b/src/include/ZMap/zmapGLibUtils.h index 55fc72df6..f78de1f30 100755 --- a/src/include/ZMap/zmapGLibUtils.h +++ b/src/include/ZMap/zmapGLibUtils.h @@ -26,9 +26,9 @@ * glib but not included with their distribution. * * HISTORY: - * Last edited: Sep 6 18:05 2006 (edgrif) + * Last edited: Oct 2 16:05 2006 (edgrif) * Created: Thu Oct 13 15:56:54 2005 (edgrif) - * CVS info: $Id: zmapGLibUtils.h,v 1.9 2006-09-15 09:09:54 edgrif Exp $ + * CVS info: $Id: zmapGLibUtils.h,v 1.10 2006-10-02 15:12:41 edgrif Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_GLIBUTILS_H @@ -71,8 +71,8 @@ void zMap_g_list_foreach_directional(GList *list, GFunc func, gpointer user_data ZMapGListDirection forward); gboolean zMap_g_list_cond_foreach(GList *list, ZMapGFuncCond func, gpointer user_data) ; GList *zMap_g_list_move(GList *list, gpointer user_data, gint new_index) ; -void zMap_g_quark_list_print(GList *quark_list) ; - +void zMap_g_list_quark_print(GList *quark_list) ; +GList *zMap_g_list_find_quark(GList *list, GQuark str_quark) ; gboolean zMap_g_string_replace(GString *string, char *target, char *source) ; diff --git a/src/zmapUtils/zmapGLibUtils.c b/src/zmapUtils/zmapGLibUtils.c index 82a6d03fb..e36607a95 100755 --- a/src/zmapUtils/zmapGLibUtils.c +++ b/src/zmapUtils/zmapGLibUtils.c @@ -26,9 +26,9 @@ * * Exported functions: See ZMap/zmapGLibUtils.h * HISTORY: - * Last edited: Sep 6 18:06 2006 (edgrif) + * Last edited: Oct 2 15:40 2006 (edgrif) * Created: Thu Oct 13 15:22:35 2005 (edgrif) - * CVS info: $Id: zmapGLibUtils.c,v 1.9 2006-09-15 09:09:54 edgrif Exp $ + * CVS info: $Id: zmapGLibUtils.c,v 1.10 2006-10-02 15:12:41 edgrif Exp $ *------------------------------------------------------------------- */ @@ -240,7 +240,7 @@ GList *zMap_g_list_move(GList *list, gpointer user_data, gint new_index) /*! * Prints out the contents of a list assuming that each element is a GQuark. We have * lots of these in zmap so this is useful. */ -void zMap_g_quark_list_print(GList *quark_list) +void zMap_g_list_quark_print(GList *quark_list) { zMapAssert(quark_list) ; @@ -250,6 +250,17 @@ void zMap_g_quark_list_print(GList *quark_list) } +GList *zMap_g_list_find_quark(GList *list, GQuark str_quark) +{ + GList *result = NULL ; + GCompareFunc compare_func ; + + zMapAssert(list && str_quark) ; + + result = g_list_find(list, GINT_TO_POINTER(str_quark)) ; + + return result ; +} -- GitLab