summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-event.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-10 20:38:04 +0000
committerLennart Poettering <lennart@poettering.net>2013-12-10 20:38:04 +0000
commit5b1bc83f81bf318aa365dc539b2e0be00fdaa63b (patch)
tree8dcdf0282b5209b82d7180172de412033139a819 /src/libsystemd-bus/sd-event.c
parentc8fa3f60302f6d1bf7b2f7b31fb7e5a46b3d53c1 (diff)
bus: when we _unref() a NULL pointer, don't use assert_return()
We support unreffing NULL pointers just fine and we shouldn't pay the _unlikely_() price for it, not get a debug message if we do, hence let's not use assert_return() here.
Diffstat (limited to 'src/libsystemd-bus/sd-event.c')
-rw-r--r--src/libsystemd-bus/sd-event.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index b5ddf71ebe..282e9145e7 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -384,7 +384,9 @@ _public_ sd_event* sd_event_ref(sd_event *e) {
}
_public_ sd_event* sd_event_unref(sd_event *e) {
- assert_return(e, NULL);
+
+ if (!e)
+ return NULL;
assert(e->n_ref >= 1);
e->n_ref--;
@@ -973,7 +975,9 @@ _public_ sd_event_source* sd_event_source_ref(sd_event_source *s) {
}
_public_ sd_event_source* sd_event_source_unref(sd_event_source *s) {
- assert_return(s, NULL);
+
+ if (!s)
+ return NULL;
assert(s->n_ref >= 1);
s->n_ref--;