Skip to content
Snippets Groups Projects
Commit 46dbf047 authored by edgrif's avatar edgrif
Browse files

add some quark/string compare utilities.

parent f092ffe8
No related branches found
No related tags found
No related merge requests found
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
* *
* Description: Utility functions for ZMap. * Description: Utility functions for ZMap.
* HISTORY: * HISTORY:
* Last edited: Apr 15 14:33 2009 (rds) * Last edited: Jun 5 17:55 2009 (edgrif)
* Created: Thu Feb 26 10:33:10 2004 (edgrif) * Created: Thu Feb 26 10:33:10 2004 (edgrif)
* CVS info: $Id: zmapUtils.h,v 1.40 2009-04-15 13:41:25 rds Exp $ * CVS info: $Id: zmapUtils.h,v 1.41 2009-06-05 17:04:44 edgrif Exp $
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
#ifndef ZMAP_UTILS_H #ifndef ZMAP_UTILS_H
...@@ -197,4 +197,13 @@ void zMapUtilsUserInit(void) ; ...@@ -197,4 +197,13 @@ void zMapUtilsUserInit(void) ;
gboolean zMapUtilsUserIsDeveloper(void) ; gboolean zMapUtilsUserIsDeveloper(void) ;
gboolean zMapUtilsUserSetDeveloper(char *passwd) ; gboolean zMapUtilsUserSetDeveloper(char *passwd) ;
void zMapPrintQuark(GQuark quark) ;
void zMapLogQuark(GQuark quark) ;
gboolean zMapLogQuarkIsStr(GQuark quark, char *str) ;
gboolean zMapLogQuarkIsExactStr(GQuark quark, char *str) ;
gboolean zMapLogQuarkHasStr(GQuark quark, char *sub_str) ;
#endif /* ZMAP_UTILS_H */ #endif /* ZMAP_UTILS_H */
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
* *
* Exported functions: See ZMap/zmapUtils.h * Exported functions: See ZMap/zmapUtils.h
* HISTORY: * HISTORY:
* Last edited: May 22 10:48 2009 (rds) * Last edited: Jun 5 17:55 2009 (edgrif)
* Created: Fri Mar 12 08:16:24 2004 (edgrif) * Created: Fri Mar 12 08:16:24 2004 (edgrif)
* CVS info: $Id: zmapUtils.c,v 1.31 2009-05-22 09:48:52 rds Exp $ * CVS info: $Id: zmapUtils.c,v 1.32 2009-06-05 17:04:44 edgrif Exp $
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
...@@ -606,6 +606,54 @@ void zMapLogQuark(GQuark quark) ...@@ -606,6 +606,54 @@ void zMapLogQuark(GQuark quark)
/*! Case insensitive compare.
* @param quark Quark to be stringified and compared.
* @param str String to be compared.
* @return TRUE if compared worked, FALSE otherwise.
*/
gboolean zMapLogQuarkIsStr(GQuark quark, char *str)
{
gboolean result = FALSE ;
if (g_ascii_strcasecmp(g_quark_to_string(quark), str) == 0)
result = TRUE ;
return result ;
}
/*! Case sensitive compare.
* @param quark Quark to be stringified and compared.
* @param str String to be compared.
* @return TRUE if compared worked, FALSE otherwise.
*/
gboolean zMapLogQuarkIsExactStr(GQuark quark, char *str)
{
gboolean result = FALSE ;
if (strcmp(g_quark_to_string(quark), str) == 0)
result = TRUE ;
return result ;
}
/*! Is str in quark.
* @param quark Quark to be stringified and compared.
* @param sub_str Sub-string to be compared.
* @return TRUE if compared worked, FALSE otherwise.
*/
gboolean zMapLogQuarkHasStr(GQuark quark, char *sub_str)
{
gboolean result = FALSE ;
if ((strstr(g_quark_to_string(quark), sub_str)))
result = TRUE ;
return result ;
}
/*! @} end of zmaputils docs. */ /*! @} end of zmaputils docs. */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment