PolicyKit: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Fri Apr 11 16:22:40 PDT 2008
src/kit/kit-hash.c | 12 ++++++------
src/kit/kit-hash.h | 8 ++++----
src/kit/kit-list.c | 6 +++---
src/kit/kit-list.h | 8 ++++----
src/polkit-dbus/polkit-dbus.c | 18 +++++++++---------
src/polkit/polkit-authorization-db.c | 2 +-
src/polkit/polkit-policy-file-entry.c | 10 +++++-----
7 files changed, 32 insertions(+), 32 deletions(-)
New commits:
commit 1c4b06620cba12e8c22f2c6f22a7503436456fb2
Author: David Zeuthen <davidz at redhat.com>
Date: Fri Apr 11 19:19:58 2008 -0400
ensure object is first in the list/hash iterator callback functions
This is useful for passing free / unref functions in.
diff --git a/src/kit/kit-hash.c b/src/kit/kit-hash.c
index 0d074ea..b4905e2 100644
--- a/src/kit/kit-hash.c
+++ b/src/kit/kit-hash.c
@@ -330,7 +330,7 @@ kit_hash_foreach (KitHash *hash, KitHashForeachFunc cb, void *user_data)
KitHashNode *node;
for (node = hash->top_nodes[n]; node != NULL; node = node->next) {
- if (cb (hash, node->key, node->value, user_data))
+ if (cb (node->key, node->value, user_data, hash))
return TRUE;
}
}
@@ -370,7 +370,7 @@ kit_hash_foreach_remove (KitHash *hash, KitHashForeachFunc cb, void *user_data)
for (node = hash->top_nodes[n]; node != NULL; node = node_next) {
node_next = node->next;
- if (cb (hash, node->key, node->value, user_data)) {
+ if (cb (node->key, node->value, user_data, hash)) {
if (hash->key_destroy_func != NULL)
hash->key_destroy_func (node->key);
@@ -472,7 +472,7 @@ kit_hash_str_copy (const void *p)
#ifdef KIT_BUILD_TESTS
static kit_bool_t
-_it1 (KitHash *hash, void *key, void *value, void *user_data)
+_it1 (void *key, void *value, void *user_data, KitHash *hash)
{
int *count = (int *) user_data;
*count += 1;
@@ -480,7 +480,7 @@ _it1 (KitHash *hash, void *key, void *value, void *user_data)
}
static kit_bool_t
-_it2 (KitHash *hash, void *key, void *value, void *user_data)
+_it2 (void *key, void *value, void *user_data, KitHash *hash)
{
int *count = (int *) user_data;
*count += 1;
@@ -488,7 +488,7 @@ _it2 (KitHash *hash, void *key, void *value, void *user_data)
}
static kit_bool_t
-_it_sum (KitHash *hash, void *key, void *value, void *user_data)
+_it_sum (void *key, void *value, void *user_data, KitHash *hash)
{
int *count = (int *) user_data;
*count += (int) value;
@@ -496,7 +496,7 @@ _it_sum (KitHash *hash, void *key, void *value, void *user_data)
}
static kit_bool_t
-_it_rem (KitHash *hash, void *key, void *value, void *user_data)
+_it_rem (void *key, void *value, void *user_data, KitHash *hash)
{
if (strlen ((char *) key) > 4)
return TRUE;
diff --git a/src/kit/kit-hash.h b/src/kit/kit-hash.h
index 51fbe54..608c4d5 100644
--- a/src/kit/kit-hash.h
+++ b/src/kit/kit-hash.h
@@ -96,19 +96,19 @@ typedef void *(*KitCopyFunc) (const void *p);
/**
* KitHashForeachFunc:
- * @hash: the hash table
* @key: key
* @value: value
* @user_data: user data passed to kit_hash_foreach()
+ * @hash: the hash table
*
* Type signature for callback function used in kit_hash_foreach().
*
* Returns: Return #TRUE to short-circuit, e.g. stop the iteration.
*/
-typedef kit_bool_t (*KitHashForeachFunc) (KitHash *hash,
- void *key,
+typedef kit_bool_t (*KitHashForeachFunc) (void *key,
void *value,
- void *user_data);
+ void *user_data,
+ KitHash *hash);
KitHash *kit_hash_new (KitHashFunc hash_func,
diff --git a/src/kit/kit-list.c b/src/kit/kit-list.c
index da030a3..d3d5367 100644
--- a/src/kit/kit-list.c
+++ b/src/kit/kit-list.c
@@ -232,7 +232,7 @@ kit_list_foreach (KitList *list, KitListForeachFunc func, void *user_data)
kit_return_val_if_fail (func != NULL, FALSE);
for (l = list; l != NULL; l = l->next) {
- if (func (list, l->data, user_data))
+ if (func (l->data, user_data, list))
return TRUE;
}
@@ -248,7 +248,7 @@ typedef struct {
} _Closure;
static kit_bool_t
-_sum (KitList *list, void *data, void *user_data)
+_sum (void *data, void *user_data, KitList *list)
{
_Closure *c = (_Closure*) user_data;
@@ -259,7 +259,7 @@ _sum (KitList *list, void *data, void *user_data)
}
static kit_bool_t
-_sum2 (KitList *list, void *data, void *user_data)
+_sum2 (void *data, void *user_data, KitList *list)
{
_Closure *c = (_Closure*) user_data;
diff --git a/src/kit/kit-list.h b/src/kit/kit-list.h
index 08c86dc..1b22ae2 100644
--- a/src/kit/kit-list.h
+++ b/src/kit/kit-list.h
@@ -57,17 +57,17 @@ struct _KitList {
/**
* KitListForeachFunc:
- * @list: the list
* @data: data of link entry
* @user_data: user data passed to kit_list_foreach()
+ * @list: the list
*
* Type signature for callback function used in kit_list_foreach().
*
* Returns: Return #TRUE to short-circuit, e.g. stop the iteration.
*/
-typedef kit_bool_t (*KitListForeachFunc) (KitList *list,
- void *data,
- void *user_data);
+typedef kit_bool_t (*KitListForeachFunc) (void *data,
+ void *user_data,
+ KitList *list);
KitList *kit_list_append (KitList *list, void *data);
KitList *kit_list_prepend (KitList *list, void *data);
diff --git a/src/polkit-dbus/polkit-dbus.c b/src/polkit-dbus/polkit-dbus.c
index 54cc7f5..dca4258 100644
--- a/src/polkit-dbus/polkit-dbus.c
+++ b/src/polkit-dbus/polkit-dbus.c
@@ -774,7 +774,7 @@ out:
}
static kit_bool_t
-_free_elem_in_list (KitList *list, void *data, void *user_data)
+_free_elem_in_list (void *data, void *user_data, KitList *list)
{
kit_free (data);
return FALSE;
@@ -1161,7 +1161,7 @@ polkit_tracker_init (PolKitTracker *pk_tracker)
/*--------------------------------------------------------------------------------------------------------------*/
static void
-_set_session_inactive_iter (KitHash *hash, void *key, PolKitCaller *caller, const char *session_objpath)
+_set_session_inactive_iter (void *key, PolKitCaller *caller, const char *session_objpath, KitHash *hash)
{
char *objpath;
PolKitSession *session;
@@ -1175,7 +1175,7 @@ _set_session_inactive_iter (KitHash *hash, void *key, PolKitCaller *caller, cons
}
static void
-_set_session_active_iter (KitHash *hash, void *key, PolKitCaller *caller, const char *session_objpath)
+_set_session_active_iter (void *key, PolKitCaller *caller, const char *session_objpath, KitHash *hash)
{
char *objpath;
PolKitSession *session;
@@ -1191,7 +1191,7 @@ _set_session_active_iter (KitHash *hash, void *key, PolKitCaller *caller, const
static void
_update_session_is_active (PolKitTracker *pk_tracker, const char *session_objpath, kit_bool_t is_active)
{
- kit_hash_foreach (pk_tracker->dbus_name_to_caller,
+ kit_hash_foreach (pk_tracker->dbus_name_to_caller,
(KitHashForeachFunc) (is_active ? _set_session_active_iter : _set_session_inactive_iter),
(void *) session_objpath);
}
@@ -1199,7 +1199,7 @@ _update_session_is_active (PolKitTracker *pk_tracker, const char *session_objpat
/*--------------------------------------------------------------------------------------------------------------*/
static kit_bool_t
-_remove_caller_by_session_iter (KitHash *hash, void *key, PolKitCaller *caller, const char *session_objpath)
+_remove_caller_by_session_iter (void *key, PolKitCaller *caller, const char *session_objpath, KitHash *hash)
{
char *objpath;
PolKitSession *session;
@@ -1223,7 +1223,7 @@ _remove_caller_by_session (PolKitTracker *pk_tracker, const char *session_objpat
/*--------------------------------------------------------------------------------------------------------------*/
static kit_bool_t
-_remove_caller_by_dbus_name_iter (KitHash *hash, void *key, PolKitCaller *caller, const char *dbus_name)
+_remove_caller_by_dbus_name_iter (void *key, PolKitCaller *caller, const char *dbus_name, KitHash *hash)
{
char *name;
if (!polkit_caller_get_dbus_name (caller, &name))
@@ -1236,9 +1236,9 @@ _remove_caller_by_dbus_name_iter (KitHash *hash, void *key, PolKitCaller *caller
static void
_remove_caller_by_dbus_name (PolKitTracker *pk_tracker, const char *dbus_name)
{
- kit_hash_foreach_remove (pk_tracker->dbus_name_to_caller,
- (KitHashForeachFunc) _remove_caller_by_dbus_name_iter,
- (void *) dbus_name);
+ kit_hash_foreach_remove (pk_tracker->dbus_name_to_caller,
+ (KitHashForeachFunc) _remove_caller_by_dbus_name_iter,
+ (void *) dbus_name);
}
/*--------------------------------------------------------------------------------------------------------------*/
diff --git a/src/polkit/polkit-authorization-db.c b/src/polkit/polkit-authorization-db.c
index f40f5fd..7ffdfe6 100644
--- a/src/polkit/polkit-authorization-db.c
+++ b/src/polkit/polkit-authorization-db.c
@@ -77,7 +77,7 @@ struct _PolKitAuthorizationDB;
/* PolKitAuthorizationDB structure is defined in polkit/polkit-private.h */
static kit_bool_t
-clear_auth (KitList *list, void *data, void *user_data)
+clear_auth (void *data, void *user_data, KitList *list)
{
PolKitAuthorization *auth = (PolKitAuthorization *) data;
polkit_authorization_unref (auth);
diff --git a/src/polkit/polkit-policy-file-entry.c b/src/polkit/polkit-policy-file-entry.c
index f7bd524..4de3d50 100644
--- a/src/polkit/polkit-policy-file-entry.c
+++ b/src/polkit/polkit-policy-file-entry.c
@@ -558,10 +558,10 @@ typedef struct {
} _AnnotationsClosure;
static polkit_bool_t
-_annotations_cb (KitHash *hash,
- void *key,
+_annotations_cb (void *key,
void *value,
- void *user_data)
+ void *user_data,
+ KitHash *hash)
{
_AnnotationsClosure *closure = user_data;
return closure->cb (closure->pfe, (const char *) key, (const char *) value, closure->user_data);
@@ -593,8 +593,8 @@ polkit_policy_file_entry_annotations_foreach (PolKitPolicyFileEntry *policy_file
closure.user_data = user_data;
return kit_hash_foreach (policy_file_entry->annotations,
- _annotations_cb,
- &closure);
+ _annotations_cb,
+ &closure);
}
/**
More information about the hal-commit
mailing list