summaryrefslogtreecommitdiff
path: root/dbus/dbus-watch.c
diff options
context:
space:
mode:
authorChristian Dywan <christian.dywan@lanedo.com>2010-09-23 14:38:15 +0200
committerWill Thompson <will.thompson@collabora.co.uk>2010-09-23 20:36:07 +0100
commit63d3e3d9d4ebc808eaa1b12a0e4f603c04854e9f (patch)
tree4bc2d1c94e7ea56d28cfa42900f56493db641471 /dbus/dbus-watch.c
parentb6449b91cce4128be8ae032e90c40ae69aa877b4 (diff)
downloaddbus-63d3e3d9d4ebc808eaa1b12a0e4f603c04854e9f.tar.gz
Add return_if_fail watch != NULL in public DBusWatch API
Reviewed-by: Havoc Pennington <hp@pobox.com> Signed-off-by: Will Thompson <will.thompson@collabora.co.uk>
Diffstat (limited to 'dbus/dbus-watch.c')
-rw-r--r--dbus/dbus-watch.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c
index 5acb2020..8d759e5e 100644
--- a/dbus/dbus-watch.c
+++ b/dbus/dbus-watch.c
@@ -496,6 +496,8 @@ _dbus_watch_set_handler (DBusWatch *watch,
int
dbus_watch_get_fd (DBusWatch *watch)
{
+ _dbus_return_val_if_fail (watch != NULL, -1);
+
return dbus_watch_get_unix_fd(watch);
}
@@ -515,6 +517,8 @@ dbus_watch_get_fd (DBusWatch *watch)
int
dbus_watch_get_unix_fd (DBusWatch *watch)
{
+ _dbus_return_val_if_fail (watch != NULL, -1);
+
/* FIXME remove #ifdef and do this on a lower level
* (watch should have set_socket and set_unix_fd and track
* which it has, and the transport should provide the
@@ -542,6 +546,8 @@ dbus_watch_get_unix_fd (DBusWatch *watch)
int
dbus_watch_get_socket (DBusWatch *watch)
{
+ _dbus_return_val_if_fail (watch != NULL, -1);
+
return watch->fd;
}
@@ -561,6 +567,7 @@ dbus_watch_get_socket (DBusWatch *watch)
unsigned int
dbus_watch_get_flags (DBusWatch *watch)
{
+ _dbus_return_val_if_fail (watch != NULL, 0);
_dbus_assert ((watch->flags & VALID_WATCH_FLAGS) == watch->flags);
return watch->flags;
@@ -576,6 +583,8 @@ dbus_watch_get_flags (DBusWatch *watch)
void*
dbus_watch_get_data (DBusWatch *watch)
{
+ _dbus_return_val_if_fail (watch != NULL, NULL);
+
return watch->data;
}
@@ -595,6 +604,8 @@ dbus_watch_set_data (DBusWatch *watch,
void *data,
DBusFreeFunction free_data_function)
{
+ _dbus_return_if_fail (watch != NULL);
+
_dbus_verbose ("Setting watch fd %d data to data = %p function = %p from data = %p function = %p\n",
dbus_watch_get_socket (watch),
data, free_data_function, watch->data, watch->free_data_function);
@@ -616,7 +627,8 @@ dbus_watch_set_data (DBusWatch *watch,
dbus_bool_t
dbus_watch_get_enabled (DBusWatch *watch)
{
- _dbus_assert (watch != NULL);
+ _dbus_return_val_if_fail (watch != NULL, FALSE);
+
return watch->enabled;
}
@@ -647,6 +659,8 @@ dbus_bool_t
dbus_watch_handle (DBusWatch *watch,
unsigned int flags)
{
+ _dbus_return_val_if_fail (watch != NULL, FALSE);
+
#ifndef DBUS_DISABLE_CHECKS
if (watch->fd < 0 || watch->flags == 0)
{