mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-27 10:30:36 +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. (cherry picked from commit8da91cd85f) (cherry picked from commit17a3d19478)
This commit is contained in:
parent
36f73d041d
commit
c864288c57
1 changed files with 12 additions and 0 deletions
|
|
@ -1103,6 +1103,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