Skip to content
Snippets Groups Projects
Commit 80320983 authored by Simon McVittie's avatar Simon McVittie
Browse files

Merge branch 'wip/smcv/autocleanup' into 'master'

Generate autocleanup functions if GLib (or libglnx) supports it

See merge request steam/steam-runtime-tools!57
parents 8cad7e2f 79dd02ce
Branches
Tags
1 merge request!57Generate autocleanup functions if GLib (or libglnx) supports it
Pipeline #1665 passed
......@@ -108,3 +108,7 @@ const char *srt_graphics_get_version_string (SrtGraphics *self);
const char *srt_graphics_get_renderer_string (SrtGraphics *self);
const char *srt_graphics_get_messages (SrtGraphics *self);
gchar *srt_graphics_dup_parameters_string (SrtGraphics *self);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtGraphics, g_object_unref)
#endif
......@@ -100,3 +100,7 @@ SrtLibraryIssues srt_check_library_presence (const char *soname,
const char *symbols_path,
SrtLibrarySymbolsFormat symbols_format,
SrtLibrary **more_details_out);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtLibrary, g_object_unref)
#endif
......@@ -119,3 +119,7 @@ const char *srt_locale_get_requested_name (SrtLocale *self);
const char *srt_locale_get_resulting_name (SrtLocale *self);
const char *srt_locale_get_charset (SrtLocale *self);
gboolean srt_locale_is_utf8 (SrtLocale *self);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtLocale, g_object_unref)
#endif
......@@ -48,6 +48,7 @@ libsteamrt_public_headers = [
'steam-runtime-tools.h',
'steam.h',
'system-info.h',
'utils.h',
]
enums = gnome.mkenums_simple(
......
......@@ -35,5 +35,6 @@
#include <steam-runtime-tools/runtime.h>
#include <steam-runtime-tools/steam.h>
#include <steam-runtime-tools/system-info.h>
#include <steam-runtime-tools/utils.h>
#undef _SRT_IN_SINGLE_HEADER
......@@ -111,3 +111,7 @@ SrtLocaleIssues srt_system_info_get_locale_issues (SrtSystemInfo *self);
SrtLocale *srt_system_info_check_locale (SrtSystemInfo *self,
const char *requested_name,
GError **error);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtSystemInfo, g_object_unref)
#endif
/*
* Copyright © 2019 Collabora Ltd.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#if !defined(_SRT_IN_SINGLE_HEADER) && !defined(_SRT_COMPILATION)
#error "Do not include directly, use <steam-runtime-tools/steam-runtime-tools.h>"
#endif
#include <glib.h>
#include <glib-object.h>
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
static inline void
_srt_free_object_list (GList *l)
{
g_list_free_full (l, g_object_unref);
}
typedef GList SrtObjectList;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtObjectList, _srt_free_object_list)
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment