From 4ce4c9b7dc4b90d28da9a517d93859c328052604 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 15 Nov 2015 09:31:19 +0300 Subject: [PATCH] Remove GLib-compatible code related to GLib < 2.26. --- lib/glibcompat.c | 55 +------------------------------------------ lib/glibcompat.h | 12 ---------- lib/mcconfig/common.c | 11 +-------- 3 files changed, 2 insertions(+), 76 deletions(-) diff --git a/lib/glibcompat.c b/lib/glibcompat.c index 8d42232a7..2f58dbb6d 100644 --- a/lib/glibcompat.c +++ b/lib/glibcompat.c @@ -46,34 +46,8 @@ /*** file scope functions ************************************************************************/ -/*** public functions ****************************************************************************/ /* --------------------------------------------------------------------------------------------- */ - -#if ! GLIB_CHECK_VERSION (2, 16, 0) -/** - * g_strcmp0: - * @str1: (allow-none): a C string or %NULL - * @str2: (allow-none): another C string or %NULL - * - * Compares @str1 and @str2 like strcmp(). Handles %NULL - * gracefully by sorting it before non-%NULL strings. - * Comparing two %NULL pointers returns 0. - * - * Returns: an integer less than, equal to, or greater than zero, if @str1 is <, == or > than @str2. - * - * Since: 2.16 - */ -int -g_strcmp0 (const char *str1, const char *str2) -{ - if (!str1) - return -(str1 != str2); - if (!str2) - return str1 != str2; - return strcmp (str1, str2); -} -#endif /* ! GLIB_CHECK_VERSION (2, 16, 0) */ - +/*** public functions ****************************************************************************/ /* --------------------------------------------------------------------------------------------- */ #if ! GLIB_CHECK_VERSION (2, 28, 0) @@ -116,30 +90,3 @@ g_list_free_full (GList * list, GDestroyNotify free_func) #endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */ /* --------------------------------------------------------------------------------------------- */ -#if ! GLIB_CHECK_VERSION (2, 22, 0) -/** - * Creates a new GError with the given domain and code, and a message formatted with format. - * @param domain error domain - * @param code error code - * @param format printf()-style format for error message - * @param args va_list of parameters for the message format - * @returns a new GError - */ - -GError * -g_error_new_valist (GQuark domain, gint code, const gchar * format, va_list args) -{ - char *message; - GError *ret_value; - - message = g_strdup_vprintf (format, args); - - ret_value = g_error_new_literal (domain, code, message); - g_free (message); - - return ret_value; -} - -#endif /* ! GLIB_CHECK_VERSION (2, 22, 0) */ - -/* --------------------------------------------------------------------------------------------- */ diff --git a/lib/glibcompat.h b/lib/glibcompat.h index bf10eff90..3f2063758 100644 --- a/lib/glibcompat.h +++ b/lib/glibcompat.h @@ -1,10 +1,6 @@ #ifndef MC_GLIBCOMPAT_H #define MC_GLIBCOMPAT_H -#if ! GLIB_CHECK_VERSION (2, 22, 0) -#include /* for g_error_new_valist() */ -#endif /* ! GLIB_CHECK_VERSION (2, 22, 0) */ - /*** typedefs(not structures) and defined constants **********************************************/ /*** enums ***************************************************************************************/ @@ -15,14 +11,6 @@ /*** declarations of public functions ************************************************************/ -#if ! GLIB_CHECK_VERSION (2, 16, 0) -int g_strcmp0 (const char *str1, const char *str2); -#endif /* ! GLIB_CHECK_VERSION (2, 16, 0) */ - -#if ! GLIB_CHECK_VERSION (2, 22, 0) -GError *g_error_new_valist (GQuark domain, gint code, const gchar * format, va_list args); -#endif /* ! GLIB_CHECK_VERSION (2, 22, 0) */ - #if ! GLIB_CHECK_VERSION (2, 28, 0) void g_slist_free_full (GSList * list, GDestroyNotify free_func); void g_list_free_full (GList * list, GDestroyNotify free_func); diff --git a/lib/mcconfig/common.c b/lib/mcconfig/common.c index 515fa293a..ff6afdba6 100644 --- a/lib/mcconfig/common.c +++ b/lib/mcconfig/common.c @@ -185,12 +185,8 @@ mc_config_del_key (mc_config_t * mc_config, const char *group, const gchar * par { if (!mc_config || !group || !param) return FALSE; -#if GLIB_CHECK_VERSION (2, 15, 0) + return g_key_file_remove_key (mc_config->handle, group, param, NULL); -#else - g_key_file_remove_key (mc_config->handle, group, param, NULL); - return TRUE; -#endif } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -201,12 +197,7 @@ mc_config_del_group (mc_config_t * mc_config, const char *group) if (!mc_config || !group) return FALSE; -#if GLIB_CHECK_VERSION (2, 15, 0) return g_key_file_remove_group (mc_config->handle, group, NULL); -#else - g_key_file_remove_group (mc_config->handle, group, NULL); - return TRUE; -#endif } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */