Remove GLib-compatible code related to GLib < 2.26.

This commit is contained in:
Andrew Borodin 2015-11-15 09:31:19 +03:00
parent 5fad7508c5
commit 4ce4c9b7dc
3 changed files with 2 additions and 76 deletions

View File

@ -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) */
/* --------------------------------------------------------------------------------------------- */

View File

@ -1,10 +1,6 @@
#ifndef MC_GLIBCOMPAT_H
#define MC_GLIBCOMPAT_H
#if ! GLIB_CHECK_VERSION (2, 22, 0)
#include <stdarg.h> /* 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);

View File

@ -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
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */