mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-14 07:30:31 +01:00
glib-aux: add nm_clear_g_string() helper
Since g_string_free() takes an additional argument, it's not direclty usable with nm_clear_pointer(ptr, g_string_free); As workaround, add nm_clear_g_string() helper.
This commit is contained in:
parent
c3d3429916
commit
8da91cd85f
1 changed files with 12 additions and 0 deletions
|
|
@ -1136,6 +1136,18 @@ nm_clear_g_variant(GVariant **variant)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_clear_g_string(GString **ptr)
|
||||
{
|
||||
GString *s;
|
||||
|
||||
if (ptr && (s = *ptr)) {
|
||||
*ptr = NULL;
|
||||
g_string_free(s, TRUE);
|
||||
};
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_clear_g_cancellable(GCancellable **cancellable)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue