diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-10 19:31:10 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-10 19:31:10 +0000 |
commit | 35460afc4896b22b0df743b70003e8768d78111a (patch) | |
tree | 8491925a6646e175bb0215676bd05cb169e04cbe /src/libsystemd-bus/bus-message.c | |
parent | ecad10fe4a4c247da72cafbc7b37f843c7c30c06 (diff) |
Revert "libsystemd-bus: use assert_return"
This reverts commit f7e2bd5a8070ba86cba6bcbf7d1c9a8173d846d4.
Most of these checks are not programming errors, but happen during
normal runtime. For example bus_kernel_pop_memfd() is called all the
time on non-kdbus systems and is supposed to quickly fail if kdbus is
not available. However, assert_return() makes this failure
expensive, and hence has no place here. With the most recent change to
assert_return() it will even log a debug message, which should never
happen here.
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index 5e355127b0..9e712717cc 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -161,7 +161,9 @@ static void *message_extend_fields(sd_bus_message *m, size_t align, size_t sz, b size_t old_size, new_size, start; assert(m); - assert_return(!m->poisoned, NULL); + + if (m->poisoned) + return NULL; old_size = sizeof(struct bus_header) + m->header->fields_size; start = ALIGN_TO(old_size, align); @@ -987,7 +989,9 @@ struct bus_body_part *message_append_part(sd_bus_message *m) { struct bus_body_part *part; assert(m); - assert_return(!m->poisoned, NULL); + + if (m->poisoned) + return NULL; if (m->n_body_parts <= 0) { part = &m->body; @@ -1134,7 +1138,9 @@ static void *message_extend_body(sd_bus_message *m, size_t align, size_t sz, boo assert(m); assert(align > 0); assert(!m->sealed); - assert_return(!m->poisoned, NULL); + + if (m->poisoned) + return NULL; start_body = ALIGN_TO((size_t) m->header->body_size, align); end_body = start_body + sz; |