diff options
author | Kalev Lember <klember@redhat.com> | 2015-09-08 12:37:33 +0200 |
---|---|---|
committer | Kalev Lember <klember@redhat.com> | 2015-09-09 16:01:16 +0200 |
commit | 5df74a141a746d53162f3f10e6c468539ae2de13 (patch) | |
tree | 311383ffa5945f3332b904ded61545cbf3c4ae1f | |
parent | 6e9537045c14cd0dd07e7e2b709d45c677c6f257 (diff) | |
download | libsoup-5df74a141a746d53162f3f10e6c468539ae2de13.tar.gz |
Support g_autoptr() for all libsoup object types
This allows using e.g. g_autoptr(SoupSession) in other programs, but
does not make libsoup itself use g_autoptr, or require a new enough glib
to support it.
https://bugzilla.gnome.org/show_bug.cgi?id=754721
-rw-r--r-- | docs/reference/Makefile.am | 2 | ||||
-rw-r--r-- | libsoup/Makefile.am | 1 | ||||
-rw-r--r-- | libsoup/soup-autocleanups.h | 47 | ||||
-rw-r--r-- | libsoup/soup.h | 1 |
4 files changed, 50 insertions, 1 deletions
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index 6011da1d..71306f7c 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -29,7 +29,7 @@ HFILE_GLOB= CFILE_GLOB= # Header files to ignore when scanning. -IGNORE_HFILES= soup.h soup-enum-types.h \ +IGNORE_HFILES= soup.h soup-autocleanups.h soup-enum-types.h \ soup-message-private.h soup-session-private.h \ soup-auth-basic.h soup-auth-digest.h soup-auth-ntlm.h \ soup-connection.h soup-connection-auth.h \ diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am index 1740f898..df25985e 100644 --- a/libsoup/Makefile.am +++ b/libsoup/Makefile.am @@ -31,6 +31,7 @@ soup_headers = \ soup-auth-domain-basic.h \ soup-auth-domain-digest.h \ soup-auth-manager.h \ + soup-autocleanups.h \ soup-cache.h \ soup-content-decoder.h \ soup-content-sniffer.h \ diff --git a/libsoup/soup-autocleanups.h b/libsoup/soup-autocleanups.h new file mode 100644 index 00000000..f50a5cd4 --- /dev/null +++ b/libsoup/soup-autocleanups.h @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Red Hat, Inc. + * + * 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 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 SOUP_AUTOCLEANUPS_H +#define SOUP_AUTOCLEANUPS_H + +#include <libsoup/soup-types.h> + +#if SOUP_VERSION_MAX_ALLOWED >= SOUP_VERSION_2_52 +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupAddress, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupAuth, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupAuthDomain, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupCookie, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupCookieJar, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupDate, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupMessage, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupRequest, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupRequestHTTP, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupServer, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSession, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSessionAsync, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSessionFeature, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSessionSync, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSocket, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupURI, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupWebsocketConnection, g_object_unref) + +#endif +#endif + +#endif /* SOUP_AUTOCLEANUPS_H */ diff --git a/libsoup/soup.h b/libsoup/soup.h index 7c5f1ba7..9cc191a4 100644 --- a/libsoup/soup.h +++ b/libsoup/soup.h @@ -16,6 +16,7 @@ extern "C" { #include <libsoup/soup-auth-domain-basic.h> #include <libsoup/soup-auth-domain-digest.h> #include <libsoup/soup-auth-manager.h> +#include <libsoup/soup-autocleanups.h> #include <libsoup/soup-cache.h> #include <libsoup/soup-content-decoder.h> #include <libsoup/soup-content-sniffer.h> |