Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
1d65bc0f
Commit
1d65bc0f
authored
9 years ago
by
Alexander Larsson
Browse files
Options
Downloads
Patches
Plain Diff
Add backport of g_set_object
parent
dade12b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
glnx-backports.c
+20
-0
20 additions, 0 deletions
glnx-backports.c
glnx-backports.h
+10
-0
10 additions, 0 deletions
glnx-backports.h
with
30 additions
and
0 deletions
glnx-backports.c
+
20
−
0
View file @
1d65bc0f
...
...
@@ -38,4 +38,24 @@ glnx_strv_contains (const gchar * const *strv,
return
FALSE
;
}
gboolean
glnx_set_object
(
GObject
**
object_ptr
,
GObject
*
new_object
)
{
GObject
*
old_object
=
*
object_ptr
;
if
(
old_object
==
new_object
)
return
FALSE
;
if
(
new_object
!=
NULL
)
g_object_ref
(
new_object
);
*
object_ptr
=
new_object
;
if
(
old_object
!=
NULL
)
g_object_unref
(
old_object
);
return
TRUE
;
}
#endif
This diff is collapsed.
Click to expand it.
glnx-backports.h
+
10
−
0
View file @
1d65bc0f
...
...
@@ -28,9 +28,19 @@
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2, 44, 0)
#define g_strv_contains glnx_strv_contains
gboolean
glnx_strv_contains
(
const
gchar
*
const
*
strv
,
const
gchar
*
str
);
#define g_set_object(object_ptr, new_object) \
(
/* Check types match. */
\
0 ? *(object_ptr) = (new_object), FALSE : \
glnx_set_object ((GObject **) (object_ptr), (GObject *) (new_object)) \
)
gboolean
glnx_set_object
(
GObject
**
object_ptr
,
GObject
*
new_object
);
#endif
/* !GLIB_CHECK_VERSION(2, 44, 0) */
G_END_DECLS
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment