mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 21:50:17 +01:00
utils: add nm_clear_g_source() helper
Utility function to simplify the following common code:
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
to
nm_clear_g_source (&priv->timeout_id);
This commit is contained in:
parent
af2c0ef771
commit
b5beaef8fa
1 changed files with 13 additions and 0 deletions
|
|
@ -168,4 +168,17 @@ NM_DEFINE_SINGLETON_DESTRUCTOR(TYPE)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline gboolean
|
||||
nm_clear_g_source (guint *id)
|
||||
{
|
||||
if (id && *id) {
|
||||
g_source_remove (*id);
|
||||
*id = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue