summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-19 23:54:58 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-20 00:03:10 +0100
commit151b9b9662a90455262ce575a8a8ae74bf4ff336 (patch)
tree3e82f3233050d75d23fd69bfdd83aa850727395a /src/libsystemd/sd-bus
parent3db729cb8e6822114e9323f4041dcdc080f2fb3c (diff)
api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c3
-rw-r--r--src/libsystemd/sd-bus/bus-convenience.c8
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c2
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c4
-rw-r--r--src/libsystemd/sd-bus/bus-message.c28
-rw-r--r--src/libsystemd/sd-bus/bus-objects.c6
-rw-r--r--src/libsystemd/sd-bus/bus-util.c4
-rw-r--r--src/libsystemd/sd-bus/busctl.c2
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c16
-rw-r--r--src/libsystemd/sd-bus/sd-memfd.c8
-rw-r--r--src/libsystemd/sd-bus/test-bus-chat.c28
-rw-r--r--src/libsystemd/sd-bus/test-bus-cleanup.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-creds.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-gvariant.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-kernel-benchmark.c6
-rw-r--r--src/libsystemd/sd-bus/test-bus-kernel.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-marshal.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-match.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-memfd.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-server.c8
-rw-r--r--src/libsystemd/sd-bus/test-bus-zero-copy.c6
21 files changed, 77 insertions, 76 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index b4dbb5b7ee..22b95d589d 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -1207,10 +1207,11 @@ _public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128
r = sd_bus_message_new_method_call(
bus,
+ &m,
name,
"/",
"org.freedesktop.DBus.Peer",
- "GetMachineId", &m);
+ "GetMachineId");
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
index 3964960fab..6e02ad365c 100644
--- a/src/libsystemd/sd-bus/bus-convenience.c
+++ b/src/libsystemd/sd-bus/bus-convenience.c
@@ -39,7 +39,7 @@ _public_ int sd_bus_emit_signal(
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
- r = sd_bus_message_new_signal(bus, path, interface, member, &m);
+ r = sd_bus_message_new_signal(bus, &m, path, interface, member);
if (r < 0)
return r;
@@ -73,7 +73,7 @@ _public_ int sd_bus_call_method(
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
- r = sd_bus_message_new_method_call(bus, destination, path, interface, member, &m);
+ r = sd_bus_message_new_method_call(bus, &m, destination, path, interface, member);
if (r < 0)
return r;
@@ -140,7 +140,7 @@ _public_ int sd_bus_reply_method_error(
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0;
- r = sd_bus_message_new_method_error(call, e, &m);
+ r = sd_bus_message_new_method_error(call, &m, e);
if (r < 0)
return r;
@@ -386,7 +386,7 @@ _public_ int sd_bus_set_property(
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
- r = sd_bus_message_new_method_call(bus, destination, path, "org.freedesktop.DBus.Properties", "Set", &m);
+ r = sd_bus_message_new_method_call(bus, &m, destination, path, "org.freedesktop.DBus.Properties", "Set");
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 6143254a60..2d56f3c461 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -125,7 +125,7 @@ sd_bus_creds* bus_creds_new(void) {
return c;
}
-_public_ int sd_bus_creds_new_from_pid(pid_t pid, uint64_t mask, sd_bus_creds **ret) {
+_public_ int sd_bus_creds_new_from_pid(sd_bus_creds **ret, pid_t pid, uint64_t mask) {
sd_bus_creds *c;
int r;
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 8699d30b64..eec62aca9c 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -920,10 +920,10 @@ static int push_name_owner_changed(sd_bus *bus, const char *name, const char *ol
r = sd_bus_message_new_signal(
bus,
+ &m,
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
- "NameOwnerChanged",
- &m);
+ "NameOwnerChanged");
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index fe84f3f0bc..fb894eff1f 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -509,10 +509,10 @@ static sd_bus_message *message_new(sd_bus *bus, uint8_t type) {
_public_ int sd_bus_message_new_signal(
sd_bus *bus,
+ sd_bus_message **m,
const char *path,
const char *interface,
- const char *member,
- sd_bus_message **m) {
+ const char *member) {
sd_bus_message *t;
int r;
@@ -549,11 +549,11 @@ fail:
_public_ int sd_bus_message_new_method_call(
sd_bus *bus,
+ sd_bus_message **m,
const char *destination,
const char *path,
const char *interface,
- const char *member,
- sd_bus_message **m) {
+ const char *member) {
sd_bus_message *t;
int r;
@@ -647,8 +647,8 @@ _public_ int sd_bus_message_new_method_return(
_public_ int sd_bus_message_new_method_error(
sd_bus_message *call,
- const sd_bus_error *e,
- sd_bus_message **m) {
+ sd_bus_message **m,
+ const sd_bus_error *e) {
sd_bus_message *t;
int r;
@@ -697,23 +697,23 @@ _public_ int sd_bus_message_new_method_errorf(
bus_error_setfv(&error, name, format, ap);
va_end(ap);
- return sd_bus_message_new_method_error(call, &error, m);
+ return sd_bus_message_new_method_error(call, m, &error);
}
_public_ int sd_bus_message_new_method_errno(
sd_bus_message *call,
+ sd_bus_message **m,
int error,
- const sd_bus_error *p,
- sd_bus_message **m) {
+ const sd_bus_error *p) {
_cleanup_free_ sd_bus_error berror = SD_BUS_ERROR_NULL;
if (sd_bus_error_is_set(p))
- return sd_bus_message_new_method_error(call, p, m);
+ return sd_bus_message_new_method_error(call, m, p);
sd_bus_error_set_errno(&berror, error);
- return sd_bus_message_new_method_error(call, &berror, m);
+ return sd_bus_message_new_method_error(call, m, &berror);
}
_public_ int sd_bus_message_new_method_errnof(
@@ -730,7 +730,7 @@ _public_ int sd_bus_message_new_method_errnof(
bus_error_set_errnofv(&berror, error, format, ap);
va_end(ap);
- return sd_bus_message_new_method_error(call, &berror, m);
+ return sd_bus_message_new_method_error(call, m, &berror);
}
int bus_message_new_synthetic_error(
@@ -5468,14 +5468,14 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
switch ((*m)->header->type) {
case SD_BUS_MESSAGE_SIGNAL:
- r = sd_bus_message_new_signal(bus, (*m)->path, (*m)->interface, (*m)->member, &n);
+ r = sd_bus_message_new_signal(bus, &n, (*m)->path, (*m)->interface, (*m)->member);
if (r < 0)
return r;
break;
case SD_BUS_MESSAGE_METHOD_CALL:
- r = sd_bus_message_new_method_call(bus, (*m)->destination, (*m)->path, (*m)->interface, (*m)->member, &n);
+ r = sd_bus_message_new_method_call(bus, &n, (*m)->destination, (*m)->path, (*m)->interface, (*m)->member);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
index b116a5dd10..85800cb348 100644
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -2004,7 +2004,7 @@ static int emit_properties_changed_on_interface(
if (!n)
return 0;
- r = sd_bus_message_new_signal(bus, path, "org.freedesktop.DBus.Properties", "PropertiesChanged", &m);
+ r = sd_bus_message_new_signal(bus, &m, path, "org.freedesktop.DBus.Properties", "PropertiesChanged");
if (r < 0)
return r;
@@ -2373,7 +2373,7 @@ _public_ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, ch
if (m)
m = sd_bus_message_unref(m);
- r = sd_bus_message_new_signal(bus, path, "org.freedesktop.DBus.ObjectManager", "InterfacesAdded", &m);
+ r = sd_bus_message_new_signal(bus, &m, path, "org.freedesktop.DBus.ObjectManager", "InterfacesAdded");
if (r < 0)
return r;
@@ -2441,7 +2441,7 @@ _public_ int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path,
if (strv_isempty(interfaces))
return 0;
- r = sd_bus_message_new_signal(bus, path, "org.freedesktop.DBus.ObjectManager", "InterfacesRemoved", &m);
+ r = sd_bus_message_new_signal(bus, &m, path, "org.freedesktop.DBus.ObjectManager", "InterfacesRemoved");
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index 8a6a70c60e..2935f69684 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -383,11 +383,11 @@ int bus_verify_polkit_async(
r = sd_bus_message_new_method_call(
bus,
+ &pk,
"org.freedesktop.PolicyKit1",
"/org/freedesktop/PolicyKit1/Authority",
"org.freedesktop.PolicyKit1.Authority",
- "CheckAuthorization",
- &pk);
+ "CheckAuthorization");
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index a59b8eab4f..e326cc047a 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -308,7 +308,7 @@ static int status(sd_bus *bus, char *argv[]) {
if (r < 0)
r = sd_bus_get_owner(bus, argv[1], _SD_BUS_CREDS_ALL, &creds);
else
- r = sd_bus_creds_new_from_pid(pid, _SD_BUS_CREDS_ALL, &creds);
+ r = sd_bus_creds_new_from_pid(&creds, pid, _SD_BUS_CREDS_ALL);
if (r < 0) {
log_error("Failed to get credentials: %s", strerror(-r));
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index a97fcf5823..427d53061c 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -399,11 +399,11 @@ static int bus_send_hello(sd_bus *bus) {
r = sd_bus_message_new_method_call(
bus,
+ &m,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
- "Hello",
- &m);
+ "Hello");
if (r < 0)
return r;
@@ -2384,10 +2384,10 @@ static int process_closing(sd_bus *bus, sd_bus_message **ret) {
/* Then, synthesize a Disconnected message */
r = sd_bus_message_new_signal(
bus,
+ &m,
"/org/freedesktop/DBus/Local",
"org.freedesktop.DBus.Local",
- "Disconnected",
- &m);
+ "Disconnected");
if (r < 0)
return r;
@@ -2821,7 +2821,7 @@ static int attach_io_events(sd_bus *bus) {
return 0;
if (!bus->input_io_event_source) {
- r = sd_event_add_io(bus->event, bus->input_fd, 0, io_callback, bus, &bus->input_io_event_source);
+ r = sd_event_add_io(bus->event, &bus->input_io_event_source, bus->input_fd, 0, io_callback, bus);
if (r < 0)
return r;
@@ -2840,7 +2840,7 @@ static int attach_io_events(sd_bus *bus) {
assert(bus->output_fd >= 0);
if (!bus->output_io_event_source) {
- r = sd_event_add_io(bus->event, bus->output_fd, 0, io_callback, bus, &bus->output_io_event_source);
+ r = sd_event_add_io(bus->event, &bus->output_io_event_source, bus->output_fd, 0, io_callback, bus);
if (r < 0)
return r;
@@ -2889,7 +2889,7 @@ _public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
bus->event_priority = priority;
- r = sd_event_add_monotonic(bus->event, 0, 0, time_callback, bus, &bus->time_event_source);
+ r = sd_event_add_monotonic(bus->event, &bus->time_event_source, 0, 0, time_callback, bus);
if (r < 0)
goto fail;
@@ -2897,7 +2897,7 @@ _public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
if (r < 0)
goto fail;
- r = sd_event_add_exit(bus->event, quit_callback, bus, &bus->quit_event_source);
+ r = sd_event_add_exit(bus->event, &bus->quit_event_source, quit_callback, bus);
if (r < 0)
goto fail;
diff --git a/src/libsystemd/sd-bus/sd-memfd.c b/src/libsystemd/sd-bus/sd-memfd.c
index b78ea6a313..7c71476eee 100644
--- a/src/libsystemd/sd-bus/sd-memfd.c
+++ b/src/libsystemd/sd-bus/sd-memfd.c
@@ -36,7 +36,7 @@ struct sd_memfd {
FILE *f;
};
-_public_ int sd_memfd_new(const char *name, sd_memfd **m) {
+_public_ int sd_memfd_new(sd_memfd **m, const char *name) {
struct kdbus_cmd_memfd_make *cmd;
struct kdbus_item *item;
@@ -115,7 +115,7 @@ _public_ int sd_memfd_new(const char *name, sd_memfd **m) {
return 0;
}
-_public_ int sd_memfd_make(int fd, sd_memfd **m) {
+_public_ int sd_memfd_new_from_fd(sd_memfd **m, int fd) {
sd_memfd *n;
uint64_t sz;
@@ -249,11 +249,11 @@ _public_ int sd_memfd_set_size(sd_memfd *m, uint64_t sz) {
return r;
}
-_public_ int sd_memfd_new_and_map(const char *name, sd_memfd **m, size_t sz, void **p) {
+_public_ int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p) {
sd_memfd *n;
int r;
- r = sd_memfd_new(name, &n);
+ r = sd_memfd_new(&n, name);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index 021379f0b0..113d15ba97 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -340,11 +340,11 @@ finish:
r = sd_bus_message_new_method_call(
bus,
+ &q,
"org.freedesktop.systemd.test",
"/",
"org.freedesktop.systemd.test",
- "ExitClient1",
- &q);
+ "ExitClient1");
if (r < 0)
log_error("Failed to allocate method call: %s", strerror(-r));
else
@@ -386,11 +386,11 @@ static void* client2(void*p) {
r = sd_bus_message_new_method_call(
bus,
+ &m,
"org.freedesktop.systemd.test",
"/foo/bar/waldo/piep",
"org.object.test",
- "Foobar",
- &m);
+ "Foobar");
if (r < 0) {
log_error("Failed to allocate method call: %s", strerror(-r));
goto finish;
@@ -407,10 +407,10 @@ static void* client2(void*p) {
r = sd_bus_message_new_signal(
bus,
+ &m,
"/foobar",
"foo.bar",
- "Notify",
- &m);
+ "Notify");
if (r < 0) {
log_error("Failed to allocate signal: %s", strerror(-r));
goto finish;
@@ -427,11 +427,11 @@ static void* client2(void*p) {
r = sd_bus_message_new_method_call(
bus,
+ &m,
"org.freedesktop.systemd.test",
"/",
"org.freedesktop.DBus.Peer",
- "GetMachineId",
- &m);
+ "GetMachineId");
if (r < 0) {
log_error("Failed to allocate method call: %s", strerror(-r));
goto finish;
@@ -456,11 +456,11 @@ static void* client2(void*p) {
r = sd_bus_message_new_method_call(
bus,
+ &m,
"org.freedesktop.systemd.test",
"/",
"org.freedesktop.systemd.test",
- "Slow",
- &m);
+ "Slow");
if (r < 0) {
log_error("Failed to allocate method call: %s", strerror(-r));
goto finish;
@@ -480,11 +480,11 @@ static void* client2(void*p) {
r = sd_bus_message_new_method_call(
bus,
+ &m,
"org.freedesktop.systemd.test",
"/",
"org.freedesktop.systemd.test",
- "Slow",
- &m);
+ "Slow");
if (r < 0) {
log_error("Failed to allocate method call: %s", strerror(-r));
goto finish;
@@ -519,11 +519,11 @@ finish:
r = sd_bus_message_new_method_call(
bus,
+ &q,
"org.freedesktop.systemd.test",
"/",
"org.freedesktop.systemd.test",
- "ExitClient2",
- &q);
+ "ExitClient2");
if (r < 0) {
log_error("Failed to allocate method call: %s", strerror(-r));
goto finish;
diff --git a/src/libsystemd/sd-bus/test-bus-cleanup.c b/src/libsystemd/sd-bus/test-bus-cleanup.c
index d8ddb8452e..e36a69f0d1 100644
--- a/src/libsystemd/sd-bus/test-bus-cleanup.c
+++ b/src/libsystemd/sd-bus/test-bus-cleanup.c
@@ -47,7 +47,7 @@ static void test_bus_new_method_call(void) {
assert_se(sd_bus_open_system(&bus) >= 0);
- assert_se(sd_bus_message_new_method_call(bus, "a.service.name", "/an/object/path", "an.interface.name", "AMethodName", &m) >= 0);
+ assert_se(sd_bus_message_new_method_call(bus, &m, "a.service.name", "/an/object/path", "an.interface.name", "AMethodName") >= 0);
printf("after message_new_method_call: refcount %u\n", REFCNT_GET(bus->n_ref));
@@ -61,7 +61,7 @@ static void test_bus_new_signal(void) {
assert_se(sd_bus_open_system(&bus) >= 0);
- assert_se(sd_bus_message_new_signal(bus, "/an/object/path", "an.interface.name", "Name", &m) >= 0);
+ assert_se(sd_bus_message_new_signal(bus, &m, "/an/object/path", "an.interface.name", "Name") >= 0);
printf("after message_new_signal: refcount %u\n", REFCNT_GET(bus->n_ref));
diff --git a/src/libsystemd/sd-bus/test-bus-creds.c b/src/libsystemd/sd-bus/test-bus-creds.c
index 966b84c39e..c4894e8696 100644
--- a/src/libsystemd/sd-bus/test-bus-creds.c
+++ b/src/libsystemd/sd-bus/test-bus-creds.c
@@ -28,14 +28,14 @@ int main(int argc, char *argv[]) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
int r;
- r = sd_bus_creds_new_from_pid(0, _SD_BUS_CREDS_ALL, &creds);
+ r = sd_bus_creds_new_from_pid(&creds, 0, _SD_BUS_CREDS_ALL);
assert_se(r >= 0);
bus_creds_dump(creds, NULL);
creds = sd_bus_creds_unref(creds);
- r = sd_bus_creds_new_from_pid(1, _SD_BUS_CREDS_ALL, &creds);
+ r = sd_bus_creds_new_from_pid(&creds, 1, _SD_BUS_CREDS_ALL);
if (r != -EACCES) {
assert_se(r >= 0);
putchar('\n');
diff --git a/src/libsystemd/sd-bus/test-bus-gvariant.c b/src/libsystemd/sd-bus/test-bus-gvariant.c
index cb07c96273..f2c1fc1257 100644
--- a/src/libsystemd/sd-bus/test-bus-gvariant.c
+++ b/src/libsystemd/sd-bus/test-bus-gvariant.c
@@ -138,7 +138,7 @@ static void test_marshal(void) {
assert_se(sd_bus_open_system(&bus) >= 0);
bus->message_version = 2; /* dirty hack to enable gvariant*/
- assert_se(sd_bus_message_new_method_call(bus, "a.service.name", "/an/object/path/which/is/really/really/long/so/that/we/hit/the/eight/bit/boundary/by/quite/some/margin/to/test/this/stuff/that/it/really/works", "an.interface.name", "AMethodName", &m) >= 0);
+ assert_se(sd_bus_message_new_method_call(bus, &m, "a.service.name", "/an/object/path/which/is/really/really/long/so/that/we/hit/the/eight/bit/boundary/by/quite/some/margin/to/test/this/stuff/that/it/really/works", "an.interface.name", "AMethodName") >= 0);
assert_se(sd_bus_message_append(m,
"a(usv)", 3,
@@ -182,7 +182,7 @@ static void test_marshal(void) {
m = sd_bus_message_unref(m);
- assert_se(sd_bus_message_new_method_call(bus, "a.x", "/a/x", "a.x", "Ax", &m) >= 0);
+ assert_se(sd_bus_message_new_method_call(bus, &m, "a.x", "/a/x", "a.x", "Ax") >= 0);
assert_se(sd_bus_message_append(m, "as", 0) >= 0);
diff --git a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
index 04627d9a77..bfeee59d2f 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
@@ -77,7 +77,7 @@ static void transaction(sd_bus *b, size_t sz) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
uint8_t *p;
- assert_se(sd_bus_message_new_method_call(b, ":1.1", "/", "benchmark.server", "Work", &m) >= 0);
+ assert_se(sd_bus_message_new_method_call(b, &m, ":1.1", "/", "benchmark.server", "Work") >= 0);
assert_se(sd_bus_message_append_array_space(m, 'y', sz, (void**) &p) >= 0);
memset(p, 0x80, sz);
@@ -151,7 +151,7 @@ static void client_bisect(const char *address) {
}
b->use_memfd = 1;
- assert_se(sd_bus_message_new_method_call(b, ":1.1", "/", "benchmark.server", "Exit", &x) >= 0);
+ assert_se(sd_bus_message_new_method_call(b, &x, ":1.1", "/", "benchmark.server", "Exit") >= 0);
assert_se(sd_bus_message_append(x, "t", csize) >= 0);
assert_se(sd_bus_send(b, x, NULL) >= 0);
@@ -207,7 +207,7 @@ static void client_chart(const char *address) {
}
b->use_memfd = 1;
- assert_se(sd_bus_message_new_method_call(b, ":1.1", "/", "benchmark.server", "Exit", &x) >= 0);
+ assert_se(sd_bus_message_new_method_call(b, &x, ":1.1", "/", "benchmark.server", "Exit") >= 0);
assert_se(sd_bus_message_append(x, "t", csize) >= 0);
assert_se(sd_bus_send(b, x, NULL) >= 0);
diff --git a/src/libsystemd/sd-bus/test-bus-kernel.c b/src/libsystemd/sd-bus/test-bus-kernel.c
index 30cc313af4..2f0f5aa00b 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel.c
@@ -130,7 +130,7 @@ int main(int argc, char *argv[]) {
r = sd_bus_request_name(a, "net.x0pointer.foobar", 0);
assert_se(r >= 0);
- r = sd_bus_message_new_method_call(b, "net.x0pointer.foobar", "/a/path", "an.inter.face", "AMethod", &m);
+ r = sd_bus_message_new_method_call(b, &m, "net.x0pointer.foobar", "/a/path", "an.inter.face", "AMethod");
assert_se(r >= 0);
assert_se(pipe2(pipe_fds, O_CLOEXEC) >= 0);
diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c
index 4fad049ab6..85aaf95d6c 100644
--- a/src/libsystemd/sd-bus/test-bus-marshal.c
+++ b/src/libsystemd/sd-bus/test-bus-marshal.c
@@ -76,7 +76,7 @@ int main(int argc, char *argv[]) {
_cleanup_fclose_ FILE *ms = NULL;
size_t first_size = 0, second_size = 0, third_size = 0;
- r = sd_bus_message_new_method_call(NULL, "foobar.waldo", "/", "foobar.waldo", "Piep", &m);
+ r = sd_bus_message_new_method_call(NULL, &m, "foobar.waldo", "/", "foobar.waldo", "Piep");
assert_se(r >= 0);
r = sd_bus_message_append(m, "s", "a string");
@@ -245,7 +245,7 @@ int main(int argc, char *argv[]) {
r = sd_bus_message_peek_type(m, NULL, NULL);
assert_se(r == 0);
- r = sd_bus_message_new_method_call(NULL, "foobar.waldo", "/", "foobar.waldo", "Piep", &copy);
+ r = sd_bus_message_new_method_call(NULL, &copy, "foobar.waldo", "/", "foobar.waldo", "Piep");
assert_se(r >= 0);
r = sd_bus_message_rewind(m, true);
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c
index 7227e2585d..c561be2a65 100644
--- a/src/libsystemd/sd-bus/test-bus-match.c
+++ b/src/libsystemd/sd-bus/test-bus-match.c
@@ -111,7 +111,7 @@ int main(int argc, char *argv[]) {
bus_match_dump(&root, 0);
- assert_se(sd_bus_message_new_signal(NULL, "/foo/bar", "bar.x", "waldo", &m) >= 0);
+ assert_se(sd_bus_message_new_signal(NULL, &m, "/foo/bar", "bar.x", "waldo") >= 0);
assert_se(sd_bus_message_append(m, "ssss", "one", "two", "/prefix/three", "prefix.four") >= 0);
assert_se(bus_message_seal(m, 1, 0) >= 0);
diff --git a/src/libsystemd/sd-bus/test-bus-memfd.c b/src/libsystemd/sd-bus/test-bus-memfd.c
index f0f08ba818..3462732546 100644
--- a/src/libsystemd/sd-bus/test-bus-memfd.c
+++ b/src/libsystemd/sd-bus/test-bus-memfd.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
- r = sd_memfd_new(NULL, &m);
+ r = sd_memfd_new(&m, NULL);
if (r == -ENOENT)
return EXIT_TEST_SKIP;
@@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
sd_memfd_free(m);
/* new sd_memfd, same underlying memfd */
- r = sd_memfd_make(fd, &m);
+ r = sd_memfd_new_from_fd(&m, fd);
assert_se(r >= 0);
/* we did truncate it to 6 */
diff --git a/src/libsystemd/sd-bus/test-bus-server.c b/src/libsystemd/sd-bus/test-bus-server.c
index 0e65ee782a..96d6298336 100644
--- a/src/libsystemd/sd-bus/test-bus-server.c
+++ b/src/libsystemd/sd-bus/test-bus-server.c
@@ -99,8 +99,8 @@ static void *server(void *p) {
} else if (sd_bus_message_is_method_call(m, NULL, NULL)) {
r = sd_bus_message_new_method_error(
m,
- &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."),
- &reply);
+ &reply,
+ &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."));
if (r < 0) {
log_error("Failed to allocate return: %s", strerror(-r));
goto fail;
@@ -141,11 +141,11 @@ static int client(struct context *c) {
r = sd_bus_message_new_method_call(
bus,
+ &m,
"org.freedesktop.systemd.test",
"/",
"org.freedesktop.systemd.test",
- "Exit",
- &m);
+ "Exit");
if (r < 0) {
log_error("Failed to allocate method call: %s", strerror(-r));
return r;
diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c
index a2239acaa4..29e40aa0af 100644
--- a/src/libsystemd/sd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd/sd-bus/test-bus-zero-copy.c
@@ -80,7 +80,7 @@ int main(int argc, char *argv[]) {
r = sd_bus_start(b);
assert_se(r >= 0);
- r = sd_bus_message_new_method_call(b, ":1.1", "/a/path", "an.inter.face", "AMethod", &m);
+ r = sd_bus_message_new_method_call(b, &m, ":1.1", "/a/path", "an.inter.face", "AMethod");
assert_se(r >= 0);
r = sd_bus_message_open_container(m, 'r', "aysay");
@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
memset(p+1, 'L', FIRST_ARRAY-2);
p[FIRST_ARRAY-1] = '>';
- r = sd_memfd_new_and_map(NULL, &f, STRING_SIZE, (void**) &s);
+ r = sd_memfd_new_and_map(&f, NULL, STRING_SIZE, (void**) &s);
assert_se(r >= 0);
s[0] = '<';
@@ -112,7 +112,7 @@ int main(int argc, char *argv[]) {
sd_memfd_free(f);
- r = sd_memfd_new_and_map(NULL, &f, SECOND_ARRAY, (void**) &p);
+ r = sd_memfd_new_and_map(&f, NULL, SECOND_ARRAY, (void**) &p);
assert_se(r >= 0);
p[0] = '<';