diff options
author | Richard Hughes <richard@hughsie.com> | 2015-09-14 17:40:30 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-09-14 17:40:30 +0100 |
commit | 9b61dd1aed38164a22bf2bed7191bd7eddbe9398 (patch) | |
tree | 0503b3d79684d43eca2b3127ecee9cdca65b80f4 | |
parent | 83a6b1a20653c1a17f0a909f08652b5e1df44075 (diff) | |
parent | 238de4b55bd0b1f36d74fa7aaafcd3ad47ec5a22 (diff) | |
download | gusb-9b61dd1aed38164a22bf2bed7191bd7eddbe9398.tar.gz |
Merge pull request #4 from kalev/autocleanups
Support g_autoptr() for all gusb object types
-rw-r--r-- | gusb/Makefile.am | 1 | ||||
-rw-r--r-- | gusb/gusb-autocleanups.h | 36 | ||||
-rw-r--r-- | gusb/gusb.h | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/gusb/Makefile.am b/gusb/Makefile.am index 05a3db4..5c45ac5 100644 --- a/gusb/Makefile.am +++ b/gusb/Makefile.am @@ -20,6 +20,7 @@ libgusb_include_HEADERS = \ libgusbbase_includedir = $(libgusb_includedir)/gusb libgusbbase_include_HEADERS = \ + gusb-autocleanups.h \ gusb-version.h \ gusb-context.h \ gusb-context-private.h \ diff --git a/gusb/gusb-autocleanups.h b/gusb/gusb-autocleanups.h new file mode 100644 index 0000000..0adf613 --- /dev/null +++ b/gusb/gusb-autocleanups.h @@ -0,0 +1,36 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2015 Kalev Lember <klember@redhat.com> + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * 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 __GUSB_AUTOCLEANUPS_H__ +#define __GUSB_AUTOCLEANUPS_H__ + +#include <gusb/gusb-context.h> +#include <gusb/gusb-device.h> +#include <gusb/gusb-device-list.h> + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUsbContext, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUsbDevice, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUsbDeviceList, g_object_unref) + +#endif + +#endif /* __GUSB_AUTOCLEANUPS_H__ */ diff --git a/gusb/gusb.h b/gusb/gusb.h index 24c60ca..50a9cd0 100644 --- a/gusb/gusb.h +++ b/gusb/gusb.h @@ -24,6 +24,7 @@ #define __GUSB_INSIDE__ +#include <gusb/gusb-autocleanups.h> #include <gusb/gusb-context.h> #include <gusb/gusb-source.h> #include <gusb/gusb-device.h> |