diff options
author | Timm Bäder <mail@baedert.org> | 2016-04-22 14:12:55 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2016-06-16 15:01:13 +0200 |
commit | bfa1f4cdbe92e5cc0de2d92a78cb17d154040330 (patch) | |
tree | 8627a250a5d3f6041ec2c5a86ef53fefcdcab047 /rest | |
parent | 34a0bd8d768e154e74be5e8f495b3d23e7e656df (diff) | |
download | librest-bfa1f4cdbe92e5cc0de2d92a78cb17d154040330.tar.gz |
Remove glib-compat.{c,h}
Diffstat (limited to 'rest')
-rw-r--r-- | rest/Makefile.am | 2 | ||||
-rw-r--r-- | rest/glib-compat.c | 105 | ||||
-rw-r--r-- | rest/glib-compat.h | 53 | ||||
-rw-r--r-- | rest/rest-private.h | 1 |
4 files changed, 0 insertions, 161 deletions
diff --git a/rest/Makefile.am b/rest/Makefile.am index 18ae546..4df6ed4 100644 --- a/rest/Makefile.am +++ b/rest/Makefile.am @@ -3,8 +3,6 @@ CLEANFILES = # For some reason I can't use $(librest_@API_VERSION@_la_SOURCES) in # test_runner_SOURCES, so we have to do this lib_sources = \ - glib-compat.h \ - glib-compat.c \ rest-param.c \ rest-params.c \ rest-proxy.c \ diff --git a/rest/glib-compat.c b/rest/glib-compat.c deleted file mode 100644 index 01e2c9a..0000000 --- a/rest/glib-compat.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "glib-compat.h" - -#if !GLIB_CHECK_VERSION(2,28,0) -/** - * g_simple_async_result_new_take_error: (skip) - * @source_object: (allow-none): a #GObject, or %NULL - * @callback: (scope async): a #GAsyncReadyCallback - * @user_data: (closure): user data passed to @callback - * @error: a #GError - * - * Creates a #GSimpleAsyncResult from an error condition, and takes over the - * caller's ownership of @error, so the caller does not need to free it anymore. - * - * Returns: a #GSimpleAsyncResult - * - * Since: 2.28 - **/ -G_GNUC_INTERNAL GSimpleAsyncResult * -g_simple_async_result_new_take_error (GObject *source_object, - GAsyncReadyCallback callback, - gpointer user_data, - GError *error) -{ - GSimpleAsyncResult *simple; - - g_return_val_if_fail (!source_object || G_IS_OBJECT (source_object), NULL); - - simple = g_simple_async_result_new (source_object, - callback, - user_data, NULL); - g_simple_async_result_take_error (simple, error); - - return simple; -} - -/** - * spice_simple_async_result_take_error: (skip) - * @simple: a #GSimpleAsyncResult - * @error: a #GError - * - * Sets the result from @error, and takes over the caller's ownership - * of @error, so the caller does not need to free it any more. - * - * Since: 2.28 - **/ -G_GNUC_INTERNAL void -g_simple_async_result_take_error (GSimpleAsyncResult *simple, - GError *error) -{ - /* this code is different from upstream */ - /* we can't avoid extra copy/free, since the simple struct is - opaque */ - g_simple_async_result_set_from_error (simple, error); - g_error_free (error); -} - -/** - * g_simple_async_report_take_gerror_in_idle: (skip) - * @object: (allow-none): a #GObject, or %NULL - * @callback: a #GAsyncReadyCallback. - * @user_data: user data passed to @callback. - * @error: the #GError to report - * - * Reports an error in an idle function. Similar to - * g_simple_async_report_gerror_in_idle(), but takes over the caller's - * ownership of @error, so the caller does not have to free it any more. - * - * Since: 2.28 - **/ -G_GNUC_INTERNAL void -g_simple_async_report_take_gerror_in_idle (GObject *object, - GAsyncReadyCallback callback, - gpointer user_data, - GError *error) -{ - GSimpleAsyncResult *simple; - - g_return_if_fail (!object || G_IS_OBJECT (object)); - g_return_if_fail (error != NULL); - - simple = g_simple_async_result_new_take_error (object, - callback, - user_data, - error); - g_simple_async_result_complete_in_idle (simple); - g_object_unref (simple); -} - -#endif /* 2.28 */ diff --git a/rest/glib-compat.h b/rest/glib-compat.h deleted file mode 100644 index 9ce59e1..0000000 --- a/rest/glib-compat.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ -#ifndef GLIB_COMPAT_H -#define GLIB_COMPAT_H - -#include <glib-object.h> -#include <gio/gio.h> - -#if !GLIB_CHECK_VERSION(2,28,0) -#define g_clear_object(object_ptr) \ - G_STMT_START { \ - /* Only one access, please */ \ - gpointer *_p = (gpointer) (object_ptr); \ - gpointer _o; \ - \ - do \ - _o = g_atomic_pointer_get (_p); \ - while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_p, _o, NULL));\ - \ - if (_o) \ - g_object_unref (_o); \ - } G_STMT_END - -GSimpleAsyncResult * -g_simple_async_result_new_take_error (GObject *source_object, - GAsyncReadyCallback callback, - gpointer user_data, - GError *error); -void -g_simple_async_result_take_error(GSimpleAsyncResult *simple, - GError *error); -void -g_simple_async_report_take_gerror_in_idle (GObject *object, - GAsyncReadyCallback callback, - gpointer user_data, - GError *error); - -#endif /* glib 2.28 */ - -#endif /* GLIB_COMPAT_H */ diff --git a/rest/rest-private.h b/rest/rest-private.h index 606f98e..9e91fa0 100644 --- a/rest/rest-private.h +++ b/rest/rest-private.h @@ -28,7 +28,6 @@ #include <rest/rest-proxy-call.h> #include <rest/rest-xml-node.h> #include <libsoup/soup.h> -#include "glib-compat.h" G_BEGIN_DECLS |