gobjectification: 79ecaafd: A utility function to check if a pair of...
sadrul at pidgin.im
sadrul at pidgin.im
Sun Jun 22 14:41:53 EDT 2008
-----------------------------------------------------------------
Revision: 79ecaafd47f4117c4c06abd0c58198889d2dac5a
Ancestor: a21355161b8f75ed4f204fe3e5981cc68154d60a
Author: sadrul at pidgin.im
Date: 2008-06-22T05:54:12
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/79ecaafd47f4117c4c06abd0c58198889d2dac5a
Modified files:
libpurple/util.c libpurple/util.h
ChangeLog:
A utility function to check if a pair of strings are different.
This can be useful when setting some string GObject property etc.
-------------- next part --------------
============================================================
--- libpurple/util.c 5748275f286731e397f0bc8f023d381d219d3820
+++ libpurple/util.c 3003c319ba47f3d4f71e531496955d082b384062
@@ -3394,6 +3394,15 @@ purple_str_binary_to_ascii(const unsigne
return g_string_free(ret, FALSE);
}
+gboolean purple_util_strings_equal(const char *s1, const char *s2)
+{
+ if (s1 == s2)
+ return TRUE;
+ if (s1 && s2 && g_utf8_collate(s1, s2) == 0)
+ return TRUE;
+ return FALSE;
+}
+
/**************************************************************************
* URI/URL Functions
**************************************************************************/
============================================================
--- libpurple/util.h dff878705b7c4a8d4eee6bcaeb2273ebfc0c6923
+++ libpurple/util.h b5344a35520f09b2cdd40df3275c1472d1979a31
@@ -971,6 +971,18 @@ char *purple_str_binary_to_ascii(const u
* @return A newly allocated ASCIIZ string.
*/
char *purple_str_binary_to_ascii(const unsigned char *binary, guint len);
+
+/**
+ * Determine if two strings have the same value.
+ * This is just a convenience function to do all the @c NULL checks.
+ *
+ * @param s1 First string
+ * @param s2 Second string
+ * @return @c TRUE if both the strings have the same value, or both are @c NULL,
+ * @c FALSE otherwise
+ */
+gboolean purple_util_strings_equal(const char *s1, const char *s2);
+
/*@}*/
More information about the Commits
mailing list