diff options
author | Kalev Lember <klember@redhat.com> | 2015-09-14 17:43:45 +0200 |
---|---|---|
committer | Kalev Lember <klember@redhat.com> | 2015-09-14 17:43:45 +0200 |
commit | 238de4b55bd0b1f36d74fa7aaafcd3ad47ec5a22 (patch) | |
tree | 0503b3d79684d43eca2b3127ecee9cdca65b80f4 /gusb/gusb-autocleanups.h | |
parent | 83a6b1a20653c1a17f0a909f08652b5e1df44075 (diff) | |
download | gusb-238de4b55bd0b1f36d74fa7aaafcd3ad47ec5a22.tar.gz |
Support g_autoptr() for all gusb object types
This allows using e.g. g_autoptr(GUsbDevice) in other programs, but does
not make libgusb itself use g_autoptr, or require a new enough glib to
support it.
Diffstat (limited to 'gusb/gusb-autocleanups.h')
-rw-r--r-- | gusb/gusb-autocleanups.h | 36 |
1 files changed, 36 insertions, 0 deletions
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__ */ |