summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--bus/activation.c8
-rw-r--r--bus/activation.h2
-rw-r--r--bus/bus.c4
-rw-r--r--bus/bus.h2
-rw-r--r--bus/config-parser.c4
-rw-r--r--bus/config-parser.h2
-rw-r--r--bus/connection.c4
-rw-r--r--bus/connection.h2
-rw-r--r--bus/policy.c12
-rw-r--r--bus/policy.h6
-rw-r--r--bus/services.c8
-rw-r--r--bus/services.h4
-rw-r--r--bus/signals.c8
-rw-r--r--bus/signals.h4
-rw-r--r--dbus/dbus-auth.c5
-rw-r--r--dbus/dbus-auth.h2
-rw-r--r--dbus/dbus-connection-internal.h2
-rw-r--r--dbus/dbus-connection.c16
-rw-r--r--dbus/dbus-connection.h2
-rw-r--r--dbus/dbus-hash.c5
-rw-r--r--dbus/dbus-hash.h2
-rw-r--r--dbus/dbus-keyring.c5
-rw-r--r--dbus/dbus-keyring.h2
-rw-r--r--dbus/dbus-mainloop.c8
-rw-r--r--dbus/dbus-mainloop.h2
-rw-r--r--dbus/dbus-message-handler.c5
-rw-r--r--dbus/dbus-message-handler.h2
-rw-r--r--dbus/dbus-message-internal.h2
-rw-r--r--dbus/dbus-message.c12
-rw-r--r--dbus/dbus-message.h4
-rw-r--r--dbus/dbus-object-tree.c11
-rw-r--r--dbus/dbus-object-tree.h2
-rw-r--r--dbus/dbus-pending-call.c5
-rw-r--r--dbus/dbus-pending-call.h2
-rw-r--r--dbus/dbus-resources.c5
-rw-r--r--dbus/dbus-resources.h2
-rw-r--r--dbus/dbus-server.c5
-rw-r--r--dbus/dbus-server.h2
-rw-r--r--dbus/dbus-spawn.c5
-rw-r--r--dbus/dbus-spawn.h2
-rw-r--r--dbus/dbus-timeout.c5
-rw-r--r--dbus/dbus-timeout.h2
-rw-r--r--dbus/dbus-transport.c5
-rw-r--r--dbus/dbus-transport.h2
-rw-r--r--dbus/dbus-userdb.c5
-rw-r--r--dbus/dbus-userdb.h2
-rw-r--r--dbus/dbus-watch.c5
-rw-r--r--dbus/dbus-watch.h2
-rw-r--r--glib/dbus-gidl.c24
-rw-r--r--glib/dbus-gidl.h12
-rw-r--r--glib/dbus-gmain.c4
-rw-r--r--glib/dbus-gparser.c4
-rw-r--r--glib/dbus-gparser.h2
-rw-r--r--glib/dbus-gproxy.c6
55 files changed, 190 insertions, 83 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ce96840..e75e88b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-26 Mikael Hallendal <micke@imendio.com>
+
+ * bus/*.[ch]:
+ * dbus/*.[ch]:
+ * glib/*.[ch]: Made ref functions return the pointer
+
2003-11-25 Zack Rusin <zack@kde.org>
* qt/integrator.h, qt/integrator.cpp: Adding handling of DBusServer,
diff --git a/bus/activation.c b/bus/activation.c
index 5588ed86..bdb294a8 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -99,11 +99,13 @@ handle_timeout_callback (DBusTimeout *timeout,
_dbus_wait_for_memory ();
}
-static void
+static BusPendingActivation *
bus_pending_activation_ref (BusPendingActivation *pending_activation)
{
_dbus_assert (pending_activation->refcount > 0);
pending_activation->refcount += 1;
+
+ return pending_activation;
}
static void
@@ -445,12 +447,14 @@ bus_activation_new (BusContext *context,
return NULL;
}
-void
+BusActivation *
bus_activation_ref (BusActivation *activation)
{
_dbus_assert (activation->refcount > 0);
activation->refcount += 1;
+
+ return activation;
}
void
diff --git a/bus/activation.h b/bus/activation.h
index a2e174f9..2bf2eb47 100644
--- a/bus/activation.h
+++ b/bus/activation.h
@@ -32,7 +32,7 @@ BusActivation* bus_activation_new (BusContext *context,
const DBusString *address,
DBusList **directories,
DBusError *error);
-void bus_activation_ref (BusActivation *activation);
+BusActivation* bus_activation_ref (BusActivation *activation);
void bus_activation_unref (BusActivation *activation);
dbus_bool_t bus_activation_activate_service (BusActivation *activation,
DBusConnection *connection,
diff --git a/bus/bus.c b/bus/bus.c
index 69359456..73fe9e55 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -670,11 +670,13 @@ bus_context_shutdown (BusContext *context)
}
}
-void
+BusContext *
bus_context_ref (BusContext *context)
{
_dbus_assert (context->refcount > 0);
context->refcount += 1;
+
+ return context;
}
void
diff --git a/bus/bus.h b/bus/bus.h
index a2db07b8..0ebe737c 100644
--- a/bus/bus.h
+++ b/bus/bus.h
@@ -66,7 +66,7 @@ BusContext* bus_context_new (const DBusStri
int print_pid_fd,
DBusError *error);
void bus_context_shutdown (BusContext *context);
-void bus_context_ref (BusContext *context);
+BusContext* bus_context_ref (BusContext *context);
void bus_context_unref (BusContext *context);
const char* bus_context_get_type (BusContext *context);
const char* bus_context_get_address (BusContext *context);
diff --git a/bus/config-parser.c b/bus/config-parser.c
index cc55a492..ab2ed3b1 100644
--- a/bus/config-parser.c
+++ b/bus/config-parser.c
@@ -345,12 +345,14 @@ bus_config_parser_new (const DBusString *basedir,
return parser;
}
-void
+BusConfigParser *
bus_config_parser_ref (BusConfigParser *parser)
{
_dbus_assert (parser->refcount > 0);
parser->refcount += 1;
+
+ return parser;
}
void
diff --git a/bus/config-parser.h b/bus/config-parser.h
index eaeafdc5..f4488a4e 100644
--- a/bus/config-parser.h
+++ b/bus/config-parser.h
@@ -37,7 +37,7 @@ typedef struct BusConfigParser BusConfigParser;
BusConfigParser* bus_config_parser_new (const DBusString *basedir,
dbus_bool_t is_toplevel);
-void bus_config_parser_ref (BusConfigParser *parser);
+BusConfigParser* bus_config_parser_ref (BusConfigParser *parser);
void bus_config_parser_unref (BusConfigParser *parser);
dbus_bool_t bus_config_parser_check_doctype (BusConfigParser *parser,
const char *doctype,
diff --git a/bus/connection.c b/bus/connection.c
index 71102db1..cfd07651 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -471,11 +471,13 @@ bus_connections_new (BusContext *context)
return NULL;
}
-void
+BusConnections *
bus_connections_ref (BusConnections *connections)
{
_dbus_assert (connections->refcount > 0);
connections->refcount += 1;
+
+ return connections;
}
void
diff --git a/bus/connection.h b/bus/connection.h
index 00a7ce49..666de829 100644
--- a/bus/connection.h
+++ b/bus/connection.h
@@ -33,7 +33,7 @@ typedef dbus_bool_t (* BusConnectionForeachFunction) (DBusConnection *connection
BusConnections* bus_connections_new (BusContext *context);
-void bus_connections_ref (BusConnections *connections);
+BusConnections* bus_connections_ref (BusConnections *connections);
void bus_connections_unref (BusConnections *connections);
dbus_bool_t bus_connections_setup_connection (BusConnections *connections,
DBusConnection *connection);
diff --git a/bus/policy.c b/bus/policy.c
index 63131aca..5cd23ca8 100644
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -68,12 +68,14 @@ bus_policy_rule_new (BusPolicyRuleType type,
return rule;
}
-void
+BusPolicyRule *
bus_policy_rule_ref (BusPolicyRule *rule)
{
_dbus_assert (rule->refcount > 0);
rule->refcount += 1;
+
+ return rule;
}
void
@@ -178,12 +180,14 @@ bus_policy_new (void)
return NULL;
}
-void
+BusPolicy *
bus_policy_ref (BusPolicy *policy)
{
_dbus_assert (policy->refcount > 0);
policy->refcount += 1;
+
+ return policy;
}
void
@@ -628,12 +632,14 @@ bus_client_policy_new (void)
return policy;
}
-void
+BusClientPolicy *
bus_client_policy_ref (BusClientPolicy *policy)
{
_dbus_assert (policy->refcount > 0);
policy->refcount += 1;
+
+ return policy;
}
static void
diff --git a/bus/policy.h b/bus/policy.h
index 17dfbf27..f570da55 100644
--- a/bus/policy.h
+++ b/bus/policy.h
@@ -101,11 +101,11 @@ struct BusPolicyRule
BusPolicyRule* bus_policy_rule_new (BusPolicyRuleType type,
dbus_bool_t allow);
-void bus_policy_rule_ref (BusPolicyRule *rule);
+BusPolicyRule* bus_policy_rule_ref (BusPolicyRule *rule);
void bus_policy_rule_unref (BusPolicyRule *rule);
BusPolicy* bus_policy_new (void);
-void bus_policy_ref (BusPolicy *policy);
+BusPolicy* bus_policy_ref (BusPolicy *policy);
void bus_policy_unref (BusPolicy *policy);
BusClientPolicy* bus_policy_create_client_policy (BusPolicy *policy,
DBusConnection *connection,
@@ -127,7 +127,7 @@ dbus_bool_t bus_policy_merge (BusPolicy *policy,
BusPolicy *to_absorb);
BusClientPolicy* bus_client_policy_new (void);
-void bus_client_policy_ref (BusClientPolicy *policy);
+BusClientPolicy* bus_client_policy_ref (BusClientPolicy *policy);
void bus_client_policy_unref (BusClientPolicy *policy);
dbus_bool_t bus_client_policy_check_can_send (BusClientPolicy *policy,
BusRegistry *registry,
diff --git a/bus/services.c b/bus/services.c
index 84cabe21..a8020a17 100644
--- a/bus/services.c
+++ b/bus/services.c
@@ -82,11 +82,13 @@ bus_registry_new (BusContext *context)
return NULL;
}
-void
+BusRegistry *
bus_registry_ref (BusRegistry *registry)
{
_dbus_assert (registry->refcount > 0);
registry->refcount += 1;
+
+ return registry;
}
void
@@ -713,12 +715,14 @@ bus_service_remove_owner (BusService *service,
return TRUE;
}
-void
+BusService *
bus_service_ref (BusService *service)
{
_dbus_assert (service->refcount > 0);
service->refcount += 1;
+
+ return service;
}
void
diff --git a/bus/services.h b/bus/services.h
index bed950c3..40300df9 100644
--- a/bus/services.h
+++ b/bus/services.h
@@ -33,7 +33,7 @@ typedef void (* BusServiceForeachFunction) (BusService *service,
void *data);
BusRegistry* bus_registry_new (BusContext *context);
-void bus_registry_ref (BusRegistry *registry);
+BusRegistry* bus_registry_ref (BusRegistry *registry);
void bus_registry_unref (BusRegistry *registry);
BusService* bus_registry_lookup (BusRegistry *registry,
const DBusString *service_name);
@@ -56,7 +56,7 @@ dbus_bool_t bus_registry_acquire_service (BusRegistry *registry
BusTransaction *transaction,
DBusError *error);
-void bus_service_ref (BusService *service);
+BusService* bus_service_ref (BusService *service);
void bus_service_unref (BusService *service);
dbus_bool_t bus_service_add_owner (BusService *service,
DBusConnection *owner,
diff --git a/bus/signals.c b/bus/signals.c
index 9c0d31e2..d136e613 100644
--- a/bus/signals.c
+++ b/bus/signals.c
@@ -59,12 +59,14 @@ bus_match_rule_new (DBusConnection *matches_go_to)
return rule;
}
-void
+BusMatchRule *
bus_match_rule_ref (BusMatchRule *rule)
{
_dbus_assert (rule->refcount > 0);
rule->refcount += 1;
+
+ return rule;
}
void
@@ -765,12 +767,14 @@ bus_matchmaker_new (void)
return matchmaker;
}
-void
+BusMatchmaker *
bus_matchmaker_ref (BusMatchmaker *matchmaker)
{
_dbus_assert (matchmaker->refcount > 0);
matchmaker->refcount += 1;
+
+ return matchmaker;
}
void
diff --git a/bus/signals.h b/bus/signals.h
index fab018ae..ef578c86 100644
--- a/bus/signals.h
+++ b/bus/signals.h
@@ -40,7 +40,7 @@ typedef enum
} BusMatchFlags;
BusMatchRule* bus_match_rule_new (DBusConnection *matches_go_to);
-void bus_match_rule_ref (BusMatchRule *rule);
+BusMatchRule* bus_match_rule_ref (BusMatchRule *rule);
void bus_match_rule_unref (BusMatchRule *rule);
dbus_bool_t bus_match_rule_set_message_type (BusMatchRule *rule,
@@ -61,7 +61,7 @@ BusMatchRule* bus_match_rule_parse (DBusConnection *matches_go_to,
DBusError *error);
BusMatchmaker* bus_matchmaker_new (void);
-void bus_matchmaker_ref (BusMatchmaker *matchmaker);
+BusMatchmaker* bus_matchmaker_ref (BusMatchmaker *matchmaker);
void bus_matchmaker_unref (BusMatchmaker *matchmaker);
dbus_bool_t bus_matchmaker_add_rule (BusMatchmaker *matchmaker,
diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
index cdfd3bb2..7c7befb1 100644
--- a/dbus/dbus-auth.c
+++ b/dbus/dbus-auth.c
@@ -1894,13 +1894,16 @@ _dbus_auth_client_new (void)
* Increments the refcount of an auth object.
*
* @param auth the auth conversation
+ * @returns the auth conversation
*/
-void
+DBusAuth *
_dbus_auth_ref (DBusAuth *auth)
{
_dbus_assert (auth != NULL);
auth->refcount += 1;
+
+ return auth;
}
/**
diff --git a/dbus/dbus-auth.h b/dbus/dbus-auth.h
index 98e4369d..48221ea0 100644
--- a/dbus/dbus-auth.h
+++ b/dbus/dbus-auth.h
@@ -44,7 +44,7 @@ typedef enum
DBusAuth* _dbus_auth_server_new (void);
DBusAuth* _dbus_auth_client_new (void);
-void _dbus_auth_ref (DBusAuth *auth);
+DBusAuth* _dbus_auth_ref (DBusAuth *auth);
void _dbus_auth_unref (DBusAuth *auth);
dbus_bool_t _dbus_auth_set_mechanisms (DBusAuth *auth,
const char **mechanisms);
diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h
index e53908b5..6afd3301 100644
--- a/dbus/dbus-connection-internal.h
+++ b/dbus/dbus-connection-internal.h
@@ -46,7 +46,7 @@ typedef enum
void _dbus_connection_lock (DBusConnection *connection);
void _dbus_connection_unlock (DBusConnection *connection);
-void _dbus_connection_ref_unlocked (DBusConnection *connection);
+DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection);
void _dbus_connection_unref_unlocked (DBusConnection *connection);
dbus_bool_t _dbus_connection_queue_received_message (DBusConnection *connection,
DBusMessage *message);
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 7871f922..01ebeb1c 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -219,11 +219,13 @@ static void _dbus_connection_update_dispatch_status_and_unlock (DB
DBusDispatchStatus new_status);
static void _dbus_connection_last_unref (DBusConnection *connection);
-static void
+static DBusMessageFilter *
_dbus_message_filter_ref (DBusMessageFilter *filter)
{
_dbus_assert (filter->refcount.value > 0);
_dbus_atomic_inc (&filter->refcount);
+
+ return filter;
}
static void
@@ -963,8 +965,9 @@ _dbus_connection_new_for_transport (DBusTransport *transport)
* Requires that the caller already holds the connection lock.
*
* @param connection the connection.
+ * @returns the connection.
*/
-void
+DBusConnection *
_dbus_connection_ref_unlocked (DBusConnection *connection)
{
#ifdef DBUS_HAVE_ATOMIC_INT
@@ -973,6 +976,8 @@ _dbus_connection_ref_unlocked (DBusConnection *connection)
_dbus_assert (connection->refcount.value > 0);
connection->refcount.value += 1;
#endif
+
+ return connection;
}
/**
@@ -1117,11 +1122,12 @@ dbus_connection_open (const char *address,
* Increments the reference count of a DBusConnection.
*
* @param connection the connection.
+ * @returns the connection.
*/
-void
+DBusConnection *
dbus_connection_ref (DBusConnection *connection)
{
- _dbus_return_if_fail (connection != NULL);
+ _dbus_return_val_if_fail (connection != NULL, NULL);
/* The connection lock is better than the global
* lock in the atomic increment fallback
@@ -1136,6 +1142,8 @@ dbus_connection_ref (DBusConnection *connection)
connection->refcount.value += 1;
CONNECTION_UNLOCK (connection);
#endif
+
+ return connection;
}
static void
diff --git a/dbus/dbus-connection.h b/dbus/dbus-connection.h
index aa92b30a..c2251c86 100644
--- a/dbus/dbus-connection.h
+++ b/dbus/dbus-connection.h
@@ -95,7 +95,7 @@ typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *con
DBusConnection* dbus_connection_open (const char *address,
DBusError *error);
-void dbus_connection_ref (DBusConnection *connection);
+DBusConnection* dbus_connection_ref (DBusConnection *connection);
void dbus_connection_unref (DBusConnection *connection);
void dbus_connection_disconnect (DBusConnection *connection);
dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
diff --git a/dbus/dbus-hash.c b/dbus/dbus-hash.c
index d35087b4..b0581510 100644
--- a/dbus/dbus-hash.c
+++ b/dbus/dbus-hash.c
@@ -348,11 +348,14 @@ _dbus_hash_table_new (DBusHashType type,
* Increments the reference count for a hash table.
*
* @param table the hash table to add a reference to.
+ * @returns the hash table.
*/
-void
+DBusHashTable *
_dbus_hash_table_ref (DBusHashTable *table)
{
table->refcount += 1;
+
+ return table;
}
/**
diff --git a/dbus/dbus-hash.h b/dbus/dbus-hash.h
index 5e7515f9..58fd5bf8 100644
--- a/dbus/dbus-hash.h
+++ b/dbus/dbus-hash.h
@@ -61,7 +61,7 @@ typedef enum
DBusHashTable* _dbus_hash_table_new (DBusHashType type,
DBusFreeFunction key_free_function,
DBusFreeFunction value_free_function);
-void _dbus_hash_table_ref (DBusHashTable *table);
+DBusHashTable* _dbus_hash_table_ref (DBusHashTable *table);
void _dbus_hash_table_unref (DBusHashTable *table);
void _dbus_hash_iter_init (DBusHashTable *table,
DBusHashIter *iter);
diff --git a/dbus/dbus-keyring.c b/dbus/dbus-keyring.c
index e091d801..99de65cf 100644
--- a/dbus/dbus-keyring.c
+++ b/dbus/dbus-keyring.c
@@ -657,11 +657,14 @@ _dbus_keyring_reload (DBusKeyring *keyring,
* Increments reference count of the keyring
*
* @param keyring the keyring
+ * @returns the keyring
*/
-void
+DBusKeyring *
_dbus_keyring_ref (DBusKeyring *keyring)
{
keyring->refcount += 1;
+
+ return keyring;
}
/**
diff --git a/dbus/dbus-keyring.h b/dbus/dbus-keyring.h
index 2a450ec8..d4e2a57e 100644
--- a/dbus/dbus-keyring.h
+++ b/dbus/dbus-keyring.h
@@ -34,7 +34,7 @@ typedef struct DBusKeyring DBusKeyring;
DBusKeyring* _dbus_keyring_new_homedir (const DBusString *username,
const DBusString *context,
DBusError *error);
-void _dbus_keyring_ref (DBusKeyring *keyring);
+DBusKeyring* _dbus_keyring_ref (DBusKeyring *keyring);
void _dbus_keyring_unref (DBusKeyring *keyring);
dbus_bool_t _dbus_keyring_validate_context (const DBusString *context);
int _dbus_keyring_get_best_key (DBusKeyring *keyring,
diff --git a/dbus/dbus-mainloop.c b/dbus/dbus-mainloop.c
index 6da5318c..dd0c015c 100644
--- a/dbus/dbus-mainloop.c
+++ b/dbus/dbus-mainloop.c
@@ -123,12 +123,14 @@ timeout_callback_new (DBusTimeout *timeout,
return cb;
}
-static void
+static Callback *
callback_ref (Callback *cb)
{
_dbus_assert (cb->refcount > 0);
cb->refcount += 1;
+
+ return cb;
}
static void
@@ -204,13 +206,15 @@ _dbus_loop_new (void)
return loop;
}
-void
+DBusLoop *
_dbus_loop_ref (DBusLoop *loop)
{
_dbus_assert (loop != NULL);
_dbus_assert (loop->refcount > 0);
loop->refcount += 1;
+
+ return loop;
}
void
diff --git a/dbus/dbus-mainloop.h b/dbus/dbus-mainloop.h
index 8a3cde13..fadc5ad9 100644
--- a/dbus/dbus-mainloop.h
+++ b/dbus/dbus-mainloop.h
@@ -37,7 +37,7 @@ typedef void (* DBusTimeoutFunction) (DBusTimeout *timeout,
void *data);
DBusLoop* _dbus_loop_new (void);
-void _dbus_loop_ref (DBusLoop *loop);
+DBusLoop* _dbus_loop_ref (DBusLoop *loop);
void _dbus_loop_unref (DBusLoop *loop);
dbus_bool_t _dbus_loop_add_watch (DBusLoop *loop,
DBusWatch *watch,
diff --git a/dbus/dbus-message-handler.c b/dbus/dbus-message-handler.c
index f38e5100..89f180a4 100644
--- a/dbus/dbus-message-handler.c
+++ b/dbus/dbus-message-handler.c
@@ -189,13 +189,16 @@ dbus_message_handler_new (DBusHandleMessageFunction function,
* Increments the reference count on a message handler.
*
* @param handler the handler
+ * @returns the handler
*/
-void
+DBusMessageHandler *
dbus_message_handler_ref (DBusMessageHandler *handler)
{
_dbus_return_if_fail (handler != NULL);
_dbus_atomic_inc (&handler->refcount);
+
+ return handler;
}
/**
diff --git a/dbus/dbus-message-handler.h b/dbus/dbus-message-handler.h
index dac015ac..ab6f0508 100644
--- a/dbus/dbus-message-handler.h
+++ b/dbus/dbus-message-handler.h
@@ -43,7 +43,7 @@ DBusMessageHandler* dbus_message_handler_new (DBusHandleMessageFunction functio
DBusFreeFunction free_user_data);
-void dbus_message_handler_ref (DBusMessageHandler *handler);
+DBusMessageHandler* dbus_message_handler_ref (DBusMessageHandler *handler);
void dbus_message_handler_unref (DBusMessageHandler *handler);
diff --git a/dbus/dbus-message-internal.h b/dbus/dbus-message-internal.h
index 53711f3d..26f1676b 100644
--- a/dbus/dbus-message-internal.h
+++ b/dbus/dbus-message-internal.h
@@ -48,7 +48,7 @@ void _dbus_message_remove_size_counter (DBusMessage *message,
DBusList **link_return);
DBusMessageLoader* _dbus_message_loader_new (void);
-void _dbus_message_loader_ref (DBusMessageLoader *loader);
+DBusMessageLoader* _dbus_message_loader_ref (DBusMessageLoader *loader);
void _dbus_message_loader_unref (DBusMessageLoader *loader);
void _dbus_message_loader_get_buffer (DBusMessageLoader *loader,
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 50f3107c..2e4ef0be 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -1504,17 +1504,20 @@ dbus_message_copy (const DBusMessage *message)
* Increments the reference count of a DBusMessage.
*
* @param message The message
+ * @returns the message
* @see dbus_message_unref
*/
-void
+DBusMessage *
dbus_message_ref (DBusMessage *message)
{
dbus_int32_t old_refcount;
- _dbus_return_if_fail (message != NULL);
+ _dbus_return_val_if_fail (message != NULL, NULL);
old_refcount = _dbus_atomic_inc (&message->refcount);
_dbus_assert (old_refcount >= 1);
+
+ return message;
}
static void
@@ -4781,11 +4784,14 @@ _dbus_message_loader_new (void)
* Increments the reference count of the loader.
*
* @param loader the loader.
+ * @returns the loader
*/
-void
+DBusMessageLoader *
_dbus_message_loader_ref (DBusMessageLoader *loader)
{
loader->refcount += 1;
+
+ return loader;
}
/**
diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h
index 90865789..038fdc87 100644
--- a/dbus/dbus-message.h
+++ b/dbus/dbus-message.h
@@ -73,9 +73,9 @@ DBusMessage* dbus_message_new_error (DBusMessage *reply_to,
const char *error_name,
const char *error_message);
-DBusMessage *dbus_message_copy (const DBusMessage *message);
+DBusMessage* dbus_message_copy (const DBusMessage *message);
-void dbus_message_ref (DBusMessage *message);
+DBusMessage* dbus_message_ref (DBusMessage *message);
void dbus_message_unref (DBusMessage *message);
int dbus_message_get_type (DBusMessage *message);
dbus_bool_t dbus_message_set_path (DBusMessage *message,
diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c
index 07d3ae59..09049195 100644
--- a/dbus/dbus-object-tree.c
+++ b/dbus/dbus-object-tree.c
@@ -46,7 +46,7 @@ typedef struct DBusObjectSubtree DBusObjectSubtree;
static DBusObjectSubtree* _dbus_object_subtree_new (const char *name,
const DBusObjectPathVTable *vtable,
void *user_data);
-static void _dbus_object_subtree_ref (DBusObjectSubtree *subtree);
+static DBusObjectSubtree* _dbus_object_subtree_ref (DBusObjectSubtree *subtree);
static void _dbus_object_subtree_unref (DBusObjectSubtree *subtree);
/**
@@ -121,13 +121,16 @@ _dbus_object_tree_new (DBusConnection *connection)
/**
* Increment the reference count
* @param tree the object tree
+ * @returns the object tree
*/
-void
+DBusObjectTree *
_dbus_object_tree_ref (DBusObjectTree *tree)
{
_dbus_assert (tree->refcount > 0);
tree->refcount += 1;
+
+ return tree;
}
/**
@@ -859,11 +862,13 @@ _dbus_object_subtree_new (const char *name,
return NULL;
}
-static void
+static DBusObjectSubtree *
_dbus_object_subtree_ref (DBusObjectSubtree *subtree)
{
_dbus_assert (subtree->refcount.value > 0);
_dbus_atomic_inc (&subtree->refcount);
+
+ return subtree;
}
static void
diff --git a/dbus/dbus-object-tree.h b/dbus/dbus-object-tree.h
index bf34d972..09e4ee29 100644
--- a/dbus/dbus-object-tree.h
+++ b/dbus/dbus-object-tree.h
@@ -30,7 +30,7 @@ DBUS_BEGIN_DECLS;
typedef struct DBusObjectTree DBusObjectTree;
DBusObjectTree* _dbus_object_tree_new (DBusConnection *connection);
-void _dbus_object_tree_ref (DBusObjectTree *tree);
+DBusObjectTree* _dbus_object_tree_ref (DBusObjectTree *tree);
void _dbus_object_tree_unref (DBusObjectTree *tree);
dbus_bool_t _dbus_object_tree_register (DBusObjectTree *tree,
diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c
index 590f1296..a19ed8b9 100644
--- a/dbus/dbus-pending-call.c
+++ b/dbus/dbus-pending-call.c
@@ -138,13 +138,16 @@ _dbus_pending_call_notify (DBusPendingCall *pending)
* Increments the reference count on a pending call.
*
* @param pending the pending call object
+ * @returns the pending call object
*/
-void
+DBusPendingCall *
dbus_pending_call_ref (DBusPendingCall *pending)
{
_dbus_return_if_fail (pending != NULL);
_dbus_atomic_inc (&pending->refcount);
+
+ return pending;
}
/**
diff --git a/dbus/dbus-pending-call.h b/dbus/dbus-pending-call.h
index 4f1e92c0..3ea1486e 100644
--- a/dbus/dbus-pending-call.h
+++ b/dbus/dbus-pending-call.h
@@ -33,7 +33,7 @@
DBUS_BEGIN_DECLS;
-void dbus_pending_call_ref (DBusPendingCall *pending);
+DBusPendingCall* dbus_pending_call_ref (DBusPendingCall *pending);
void dbus_pending_call_unref (DBusPendingCall *pending);
dbus_bool_t dbus_pending_call_set_notify (DBusPendingCall *pending,
DBusPendingCallNotifyFunction function,
diff --git a/dbus/dbus-resources.c b/dbus/dbus-resources.c
index edc2e788..a5a8e099 100644
--- a/dbus/dbus-resources.c
+++ b/dbus/dbus-resources.c
@@ -96,13 +96,16 @@ _dbus_counter_new (void)
* Increments refcount of the counter
*
* @param counter the counter
+ * @returns the counter
*/
-void
+DBusCounter *
_dbus_counter_ref (DBusCounter *counter)
{
_dbus_assert (counter->refcount > 0);
counter->refcount += 1;
+
+ return counter;
}
/**
diff --git a/dbus/dbus-resources.h b/dbus/dbus-resources.h
index 26a5b98c..2975405a 100644
--- a/dbus/dbus-resources.h
+++ b/dbus/dbus-resources.h
@@ -35,7 +35,7 @@ typedef void (* DBusCounterNotifyFunction) (DBusCounter *counter,
void *user_data);
DBusCounter* _dbus_counter_new (void);
-void _dbus_counter_ref (DBusCounter *counter);
+DBusCounter* _dbus_counter_ref (DBusCounter *counter);
void _dbus_counter_unref (DBusCounter *counter);
void _dbus_counter_adjust (DBusCounter *counter,
long delta);
diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c
index 29e20a55..2e33cac6 100644
--- a/dbus/dbus-server.c
+++ b/dbus/dbus-server.c
@@ -450,13 +450,16 @@ dbus_server_listen (const char *address,
* Increments the reference count of a DBusServer.
*
* @param server the server.
+ * @returns the server
*/
-void
+DBusServer *
dbus_server_ref (DBusServer *server)
{
_dbus_return_if_fail (server != NULL);
server->refcount += 1;
+
+ return server;
}
/**
diff --git a/dbus/dbus-server.h b/dbus/dbus-server.h
index c2a0ca0f..237e9500 100644
--- a/dbus/dbus-server.h
+++ b/dbus/dbus-server.h
@@ -41,7 +41,7 @@ typedef void (* DBusNewConnectionFunction) (DBusServer *server,
DBusServer* dbus_server_listen (const char *address,
DBusError *error);
-void dbus_server_ref (DBusServer *server);
+DBusServer* dbus_server_ref (DBusServer *server);
void dbus_server_unref (DBusServer *server);
void dbus_server_disconnect (DBusServer *server);
dbus_bool_t dbus_server_get_is_connected (DBusServer *server);
diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c
index 604b9e7c..0e62f951 100644
--- a/dbus/dbus-spawn.c
+++ b/dbus/dbus-spawn.c
@@ -235,14 +235,17 @@ _dbus_babysitter_new (void)
* Increment the reference count on the babysitter object.
*
* @param sitter the babysitter
+ * @returns the babysitter
*/
-void
+DBusBabysitter *
_dbus_babysitter_ref (DBusBabysitter *sitter)
{
_dbus_assert (sitter != NULL);
_dbus_assert (sitter->refcount > 0);
sitter->refcount += 1;
+
+ return sitter;
}
/**
diff --git a/dbus/dbus-spawn.h b/dbus/dbus-spawn.h
index a467beec..9771144d 100644
--- a/dbus/dbus-spawn.h
+++ b/dbus/dbus-spawn.h
@@ -40,7 +40,7 @@ dbus_bool_t _dbus_spawn_async_with_babysitter (DBusBabysitter **si
DBusSpawnChildSetupFunc child_setup,
void *user_data,
DBusError *error);
-void _dbus_babysitter_ref (DBusBabysitter *sitter);
+DBusBabysitter* _dbus_babysitter_ref (DBusBabysitter *sitter);
void _dbus_babysitter_unref (DBusBabysitter *sitter);
void _dbus_babysitter_kill_child (DBusBabysitter *sitter);
dbus_bool_t _dbus_babysitter_get_child_exited (DBusBabysitter *sitter);
diff --git a/dbus/dbus-timeout.c b/dbus/dbus-timeout.c
index b15089db..bd740963 100644
--- a/dbus/dbus-timeout.c
+++ b/dbus/dbus-timeout.c
@@ -86,11 +86,14 @@ _dbus_timeout_new (int interval,
* Increments the reference count of a DBusTimeout object.
*
* @param timeout the timeout object.
+ * @returns the timeout object.
*/
-void
+DBusTimeout *
_dbus_timeout_ref (DBusTimeout *timeout)
{
timeout->refcount += 1;
+
+ return timeout;
}
/**
diff --git a/dbus/dbus-timeout.h b/dbus/dbus-timeout.h
index c68f29fa..3950257c 100644
--- a/dbus/dbus-timeout.h
+++ b/dbus/dbus-timeout.h
@@ -38,7 +38,7 @@ DBusTimeout* _dbus_timeout_new (int interval,
DBusTimeoutHandler handler,
void *data,
DBusFreeFunction free_data_function);
-void _dbus_timeout_ref (DBusTimeout *timeout);
+DBusTimeout* _dbus_timeout_ref (DBusTimeout *timeout);
void _dbus_timeout_unref (DBusTimeout *timeout);
void _dbus_timeout_set_interval (DBusTimeout *timeout,
int interval);
diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c
index b58073f6..40fc98d0 100644
--- a/dbus/dbus-transport.c
+++ b/dbus/dbus-transport.c
@@ -365,13 +365,16 @@ _dbus_transport_open (const char *address,
* Increments the reference count for the transport.
*
* @param transport the transport.
+ * @returns the transport.
*/
-void
+DBusTransport *
_dbus_transport_ref (DBusTransport *transport)
{
_dbus_assert (transport->refcount > 0);
transport->refcount += 1;
+
+ return transport;
}
/**
diff --git a/dbus/dbus-transport.h b/dbus/dbus-transport.h
index eadee383..6b1f4b76 100644
--- a/dbus/dbus-transport.h
+++ b/dbus/dbus-transport.h
@@ -32,7 +32,7 @@ typedef struct DBusTransport DBusTransport;
DBusTransport* _dbus_transport_open (const char *address,
DBusError *error);
-void _dbus_transport_ref (DBusTransport *transport);
+DBusTransport* _dbus_transport_ref (DBusTransport *transport);
void _dbus_transport_unref (DBusTransport *transport);
void _dbus_transport_disconnect (DBusTransport *transport);
dbus_bool_t _dbus_transport_get_is_connected (DBusTransport *transport);
diff --git a/dbus/dbus-userdb.c b/dbus/dbus-userdb.c
index 95f13981..13502306 100644
--- a/dbus/dbus-userdb.c
+++ b/dbus/dbus-userdb.c
@@ -635,13 +635,16 @@ _dbus_user_database_new (void)
/**
* Increments refcount of user database.
* @param db the database
+ * @returns the database
*/
-void
+DBusUserDatabase *
_dbus_user_database_ref (DBusUserDatabase *db)
{
_dbus_assert (db->refcount > 0);
db->refcount += 1;
+
+ return db;
}
/**
diff --git a/dbus/dbus-userdb.h b/dbus/dbus-userdb.h
index e277979e..90807478 100644
--- a/dbus/dbus-userdb.h
+++ b/dbus/dbus-userdb.h
@@ -31,7 +31,7 @@ DBUS_BEGIN_DECLS;
typedef struct DBusUserDatabase DBusUserDatabase;
DBusUserDatabase* _dbus_user_database_new (void);
-void _dbus_user_database_ref (DBusUserDatabase *db);
+DBusUserDatabase* _dbus_user_database_ref (DBusUserDatabase *db);
void _dbus_user_database_unref (DBusUserDatabase *db);
dbus_bool_t _dbus_user_database_get_groups (DBusUserDatabase *db,
dbus_uid_t uid,
diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c
index f212090a..7171dd6d 100644
--- a/dbus/dbus-watch.c
+++ b/dbus/dbus-watch.c
@@ -97,11 +97,14 @@ _dbus_watch_new (int fd,
* Increments the reference count of a DBusWatch object.
*
* @param watch the watch object.
+ * @returns the watch object.
*/
-void
+DBusWatch *
_dbus_watch_ref (DBusWatch *watch)
{
watch->refcount += 1;
+
+ return watch;
}
/**
diff --git a/dbus/dbus-watch.h b/dbus/dbus-watch.h
index 355a9b7e..bea4d59f 100644
--- a/dbus/dbus-watch.h
+++ b/dbus/dbus-watch.h
@@ -42,7 +42,7 @@ DBusWatch* _dbus_watch_new (int fd,
DBusWatchHandler handler,
void *data,
DBusFreeFunction free_data_function);
-void _dbus_watch_ref (DBusWatch *watch);
+DBusWatch* _dbus_watch_ref (DBusWatch *watch);
void _dbus_watch_unref (DBusWatch *watch);
void _dbus_watch_invalidate (DBusWatch *watch);
void _dbus_watch_sanitize_condition (DBusWatch *watch,
diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c
index 596b43ca..aecdc002 100644
--- a/glib/dbus-gidl.c
+++ b/glib/dbus-gidl.c
@@ -67,13 +67,15 @@ struct ArgInfo
ArgDirection direction;
};
-void
+BaseInfo *
base_info_ref (BaseInfo *info)
{
g_return_if_fail (info != NULL);
g_return_if_fail (info->refcount > 0);
info->refcount += 1;
+
+ return info;
}
static void
@@ -222,10 +224,12 @@ node_info_new (const char *name)
return info;
}
-void
+NodeInfo *
node_info_ref (NodeInfo *info)
{
info->base.refcount += 1;
+
+ return info;
}
void
@@ -287,10 +291,12 @@ interface_info_new (const char *name)
return info;
}
-void
+InterfaceInfo *
interface_info_ref (InterfaceInfo *info)
{
info->base.refcount += 1;
+
+ return info;
}
void
@@ -366,10 +372,12 @@ method_info_new (const char *name)
return info;
}
-void
+MethodInfo *
method_info_ref (MethodInfo *info)
{
info->base.refcount += 1;
+
+ return info;
}
void
@@ -416,10 +424,12 @@ signal_info_new (const char *name)
return info;
}
-void
+SignalInfo *
signal_info_ref (SignalInfo *info)
{
info->base.refcount += 1;
+
+ return info;
}
void
@@ -472,10 +482,12 @@ arg_info_new (const char *name,
return info;
}
-void
+ArgInfo *
arg_info_ref (ArgInfo *info)
{
info->base.refcount += 1;
+
+ return info;
}
void
diff --git a/glib/dbus-gidl.h b/glib/dbus-gidl.h
index f95abfbd..6df2bdfe 100644
--- a/glib/dbus-gidl.h
+++ b/glib/dbus-gidl.h
@@ -54,7 +54,7 @@ typedef enum
} InfoType;
-void base_info_ref (BaseInfo *info);
+BaseInfo* base_info_ref (BaseInfo *info);
void base_info_unref (BaseInfo *info);
InfoType base_info_get_type (BaseInfo *info);
const char* base_info_get_name (BaseInfo *info);
@@ -65,7 +65,7 @@ GType base_info_get_gtype (void);
NodeInfo* node_info_new (const char *name);
-void node_info_ref (NodeInfo *info);
+NodeInfo* node_info_ref (NodeInfo *info);
void node_info_unref (NodeInfo *info);
const char* node_info_get_name (NodeInfo *info);
GSList* node_info_get_interfaces (NodeInfo *info);
@@ -76,7 +76,7 @@ void node_info_add_node (NodeInfo *info,
NodeInfo *child);
InterfaceInfo* interface_info_new (const char *name);
-void interface_info_ref (InterfaceInfo *info);
+InterfaceInfo* interface_info_ref (InterfaceInfo *info);
void interface_info_unref (InterfaceInfo *info);
const char* interface_info_get_name (InterfaceInfo *info);
GSList* interface_info_get_methods (InterfaceInfo *info);
@@ -87,7 +87,7 @@ void interface_info_add_signal (InterfaceInfo *info,
SignalInfo *signal);
MethodInfo* method_info_new (const char *name);
-void method_info_ref (MethodInfo *info);
+MethodInfo* method_info_ref (MethodInfo *info);
void method_info_unref (MethodInfo *info);
const char* method_info_get_name (MethodInfo *info);
@@ -96,7 +96,7 @@ void method_info_add_arg (MethodInfo *info,
ArgInfo *arg);
SignalInfo* signal_info_new (const char *name);
-void signal_info_ref (SignalInfo *info);
+SignalInfo* signal_info_ref (SignalInfo *info);
void signal_info_unref (SignalInfo *info);
const char* signal_info_get_name (SignalInfo *info);
@@ -107,7 +107,7 @@ void signal_info_add_arg (SignalInfo *info,
ArgInfo* arg_info_new (const char *name,
ArgDirection direction,
int type);
-void arg_info_ref (ArgInfo *info);
+ArgInfo* arg_info_ref (ArgInfo *info);
void arg_info_unref (ArgInfo *info);
const char* arg_info_get_name (ArgInfo *info);
int arg_info_get_type (ArgInfo *info);
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index 6f0737bf..6179dc99 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -88,10 +88,12 @@ watch_fd_new (void)
return watch_fd;
}
-static void
+static WatchFD *
watch_fd_ref (WatchFD *watch_fd)
{
watch_fd->refcount += 1;
+
+ return watch_fd;
}
static void
diff --git a/glib/dbus-gparser.c b/glib/dbus-gparser.c
index 16d17f3d..c9b1b358 100644
--- a/glib/dbus-gparser.c
+++ b/glib/dbus-gparser.c
@@ -184,10 +184,12 @@ parser_new (void)
return parser;
}
-void
+Parser *
parser_ref (Parser *parser)
{
parser->refcount += 1;
+
+ return parser;
}
void
diff --git a/glib/dbus-gparser.h b/glib/dbus-gparser.h
index cc58e5e0..97831059 100644
--- a/glib/dbus-gparser.h
+++ b/glib/dbus-gparser.h
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
typedef struct Parser Parser;
Parser* parser_new (void);
-void parser_ref (Parser *parser);
+Parser* parser_ref (Parser *parser);
void parser_unref (Parser *parser);
gboolean parser_check_doctype (Parser *parser,
const char *doctype,
diff --git a/glib/dbus-gproxy.c b/glib/dbus-gproxy.c
index 02c53c56..65e43fc5 100644
--- a/glib/dbus-gproxy.c
+++ b/glib/dbus-gproxy.c
@@ -93,7 +93,7 @@ struct DBusGProxyManager
};
-static void dbus_gproxy_manager_ref (DBusGProxyManager *manager);
+static DBusGProxyManager *dbus_gproxy_manager_ref (DBusGProxyManager *manager);
static DBusHandlerResult dbus_gproxy_manager_filter (DBusConnection *connection,
DBusMessage *message,
void *user_data);
@@ -152,7 +152,7 @@ dbus_gproxy_manager_get (DBusConnection *connection)
return manager;
}
-static void
+static DBusGProxyManager *
dbus_gproxy_manager_ref (DBusGProxyManager *manager)
{
g_assert (manager != NULL);
@@ -163,6 +163,8 @@ dbus_gproxy_manager_ref (DBusGProxyManager *manager)
manager->refcount += 1;
UNLOCK_MANAGER (manager);
+
+ return manager;
}
static void