mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 03:20:18 +01:00
core: add ulong data helpers to NMAuthChain
Otherwise callers would have to do the work themselves to ensure that the top 32 bits of the ulong didn't get chopped off on 32-bit platorms.
This commit is contained in:
parent
016c56078d
commit
2e2b4373eb
2 changed files with 34 additions and 0 deletions
|
|
@ -178,6 +178,34 @@ nm_auth_chain_set_data (NMAuthChain *self,
|
|||
}
|
||||
}
|
||||
|
||||
gulong
|
||||
nm_auth_chain_get_data_ulong (NMAuthChain *self, const char *tag)
|
||||
{
|
||||
gulong *ptr;
|
||||
|
||||
g_return_val_if_fail (self != NULL, 0);
|
||||
g_return_val_if_fail (tag != NULL, 0);
|
||||
|
||||
ptr = nm_auth_chain_get_data (self, tag);
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nm_auth_chain_set_data_ulong (NMAuthChain *self,
|
||||
const char *tag,
|
||||
gulong data)
|
||||
{
|
||||
gulong *ptr;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (tag != NULL);
|
||||
|
||||
ptr = g_malloc (sizeof (*ptr));
|
||||
*ptr = data;
|
||||
nm_auth_chain_set_data (self, tag, ptr, g_free);
|
||||
}
|
||||
|
||||
NMAuthCallResult
|
||||
nm_auth_chain_get_result (NMAuthChain *self, const char *permission)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@ void nm_auth_chain_set_data (NMAuthChain *chain,
|
|||
gpointer data,
|
||||
GDestroyNotify data_destroy);
|
||||
|
||||
void nm_auth_chain_set_data_ulong (NMAuthChain *chain,
|
||||
const char *tag,
|
||||
gulong data);
|
||||
|
||||
gulong nm_auth_chain_get_data_ulong (NMAuthChain *chain, const char *tag);
|
||||
|
||||
NMAuthCallResult nm_auth_chain_get_result (NMAuthChain *chain,
|
||||
const char *permission);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue