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.
const char *p;
int r;
- assert_return(name, EINVAL);
+ if (!name)
+ return EINVAL;
p = startswith(name, "System.Error.");
if (p) {
int r;
assert(b);
- assert_return(!b->is_server, -EINVAL);
+
+ if (b->is_server)
+ return -EINVAL;
b->use_memfd = 1;
assert(b->input_fd < 0);
assert(b->output_fd < 0);
assert(b->kernel);
- assert_return(!b->is_server, -EINVAL);
+
+ if (b->is_server)
+ return -EINVAL;
b->input_fd = open(b->kernel, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (b->input_fd < 0)
assert(address);
assert(size);
- assert_return(bus && bus->is_kernel, -ENOTSUP);
+
+ if (!bus || !bus->is_kernel)
+ return -ENOTSUP;
assert_se(pthread_mutex_lock(&bus->memfd_cache_mutex) >= 0);
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);
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;
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;
int r;
- assert_return(s, -EINVAL);
+ if (!s)
+ return -EINVAL;
+
assert(l);
if (bus_type_is_basic(*s) || *s == SD_BUS_TYPE_VARIANT) {
int r;
size_t t;
- assert_return(s, false);
+ if (!s)
+ return false;
r = signature_element_length_internal(s, allow_dict_entry, 0, 0, &t);
if (r < 0)
bool signature_is_pair(const char *s) {
- assert_return(s, false);
+ if (!s)
+ return false;
if (!bus_type_is_basic(*s))
return false;
const char *p;
int r;
- assert_return(s, false);
+ if (!s)
+ return false;
p = s;
while (*p) {