diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c index 0e4b11a7c7..a3cb934c85 100644 --- a/callouts/nm-dispatcher-action.c +++ b/callouts/nm-dispatcher-action.c @@ -38,6 +38,7 @@ #include "nm-dispatcher-action.h" #include "nm-dispatcher-utils.h" +#include "nm-glib-compat.h" #define NMD_SCRIPT_DIR NMCONFDIR "/dispatcher.d" diff --git a/include/Makefile.am b/include/Makefile.am index a058bff340..10e4f04c08 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -3,6 +3,7 @@ EXTRA_DIST = \ NetworkManagerVPN.h \ nm-dbus-glib-types.h \ nm-glib-compat.h \ + nm-gvaluearray-compat.h \ nm-test-helpers.h \ nm-version.h.in \ nm-settings-flags.h diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index 63d9598dfc..49880693fa 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -27,6 +27,8 @@ #include #include +#include "nm-gvaluearray-compat.h" + #if !GLIB_CHECK_VERSION(2,31,0) #define g_value_set_schar g_value_set_char #define g_value_get_schar g_value_get_char diff --git a/include/nm-gvaluearray-compat.h b/include/nm-gvaluearray-compat.h new file mode 100644 index 0000000000..35d6b86769 --- /dev/null +++ b/include/nm-gvaluearray-compat.h @@ -0,0 +1,103 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2013 Red Hat, Inc. + */ + +#ifndef NM_GVALUEARRAY_COMPAT_H +#define NM_GVALUEARRAY_COMPAT_H + +#include + +#define g_value_array_get_type() \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_get_type (); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_get_nth(value_array, index_) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_get_nth (value_array, index_); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_new(n_prealloced) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_new (n_prealloced); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_free(value_array) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_free (value_array); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_copy(value_array) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_copy (value_array); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_prepend(value_array, value) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_prepend (value_array, value); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_append(value_array, value) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_append (value_array, value); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_insert(value_array, index_, value) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_insert (value_array, index_, value); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_remove(value_array, index_) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_remove (value_array, index_); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_sort(value_array, compare_func) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_sort (value_array, compare_func); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#define g_value_array_sort_with_data(value_array, compare_func, user_data) \ + G_GNUC_EXTENSION ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_value_array_sort_with_data (value_array, compare_func, user_data); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) + +#endif /* NM_GVALUEARRAY_COMPAT_H */ diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index ee7531b240..eaab262ab9 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -42,6 +42,7 @@ #include "nm-utils.h" #include "nm-utils-private.h" #include "NetworkManager.h" +#include "nm-glib-compat.h" #include "nm-dbus-glib-types.h" #include "nm-setting-ip4-config.h" #include "nm-setting-ip6-config.h" diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 1c88752f27..c67a4c0f53 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -39,6 +39,7 @@ #include "nm-setting-pppoe.h" #include "nm-setting-serial.h" #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" static void vpn_check_func (const char *key, const char *value, gpointer user_data) diff --git a/src/modem-manager/nm-modem-generic.c b/src/modem-manager/nm-modem-generic.c index f4e7a52fc4..ad18b18a8d 100644 --- a/src/modem-manager/nm-modem-generic.c +++ b/src/modem-manager/nm-modem-generic.c @@ -31,6 +31,7 @@ #include "NetworkManagerUtils.h" #include "nm-device-private.h" #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" G_DEFINE_TYPE (NMModemGeneric, nm_modem_generic, NM_TYPE_MODEM) diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index 61dfd7c07e..4450beedf1 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -29,6 +29,7 @@ #include "nm-logging.h" #include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" static GSList *requests = NULL; diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c index 6ddf50d57d..bd63f517a0 100644 --- a/src/settings/plugins/keyfile/reader.c +++ b/src/settings/plugins/keyfile/reader.c @@ -41,6 +41,7 @@ #include #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" #include "nm-system-config-interface.h" #include "reader.h" #include "common.h" @@ -375,8 +376,10 @@ ip_address_or_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfi GPtrArray *list; int i; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; list = g_ptr_array_new_with_free_func ( ipv6 ? (GDestroyNotify) g_value_array_free : (GDestroyNotify) g_array_unref); + G_GNUC_END_IGNORE_DEPRECATIONS; for (i = -1; i < 1000; i++) { const char **key_basename;