libpurple: Change purple_strequal() to a static inline function

Tue, 27 Nov 2018 13:56:37 -0600

author
Mike Ruprecht <cmaiku@gmail.com>
date
Tue, 27 Nov 2018 13:56:37 -0600
changeset 39323
a1bec7e58cba
parent 39322
0d0d1ab4eba6
child 39325
e610a6881980

libpurple: Change purple_strequal() to a static inline function

Since purple_strequal() is such a thin wrapper around g_strcmp0(),
it seems to make sense to make it into a static inline function.
This way, rather than calling into libpurple, only to pretty much
immediately call into GLib, it would just call into GLib directly.
The function itself is merely convenience to avoid the confusing
nature of g_strcmp0()'s return value, when a boolean is all that's
desired. This patch therefore converts purple_strequal() to a
static inline function.

libpurple/util.c file | annotate | diff | comparison | revisions
libpurple/util.h file | annotate | diff | comparison | revisions
--- a/libpurple/util.c	Sat Nov 24 08:48:37 2018 +0000
+++ b/libpurple/util.c	Tue Nov 27 13:56:37 2018 -0600
@@ -3333,12 +3333,6 @@
 /**************************************************************************
  * String Functions
  **************************************************************************/
-gboolean
-purple_strequal(const gchar *left, const gchar *right)
-{
-	return (g_strcmp0(left, right) == 0);
-}
-
 const char *
 purple_normalize(const PurpleAccount *account, const char *str)
 {
--- a/libpurple/util.h	Sat Nov 24 08:48:37 2018 +0000
+++ b/libpurple/util.h	Tue Nov 27 13:56:37 2018 -0600
@@ -1107,7 +1107,11 @@
  *
  * Returns: %TRUE if the strings are the same, else %FALSE.
  */
-gboolean purple_strequal(const gchar *left, const gchar *right);
+static inline gboolean
+purple_strequal(const gchar *left, const gchar *right)
+{
+	return (g_strcmp0(left, right) == 0);
+}
 
 /**
  * purple_normalize:

mercurial