sd-bus: make sd_bus_is_{ready,open} accept NULL

We didn't document this behaviour one way or another, so I think it's
OK to change. All callers do the NULL check before callling this to avoid
the assert warning, so it seems reasonable to do it internally.

sd_bus_can_send() is similar, but there we expressly say that an
error is returned on NULL, so I didn't change it.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-04-08 14:59:10 +02:00
parent a73f8e9f32
commit 3bbb76f621
2 changed files with 11 additions and 4 deletions
+6 -2
View File
@@ -1800,7 +1800,9 @@ void bus_enter_closing(sd_bus *bus) {
DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(sd_bus, sd_bus, bus_free);
_public_ int sd_bus_is_open(sd_bus *bus) {
assert_return(bus, -EINVAL);
if (!bus)
return 0;
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -1808,7 +1810,9 @@ _public_ int sd_bus_is_open(sd_bus *bus) {
}
_public_ int sd_bus_is_ready(sd_bus *bus) {
assert_return(bus, -EINVAL);
if (!bus)
return 0;
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(!bus_pid_changed(bus), -ECHILD);