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:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user