chiark / gitweb /
api: in constructor function calls, always put the returned object pointer first...
authorLennart Poettering <lennart@poettering.net>
Wed, 19 Feb 2014 22:54:58 +0000 (23:54 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 19 Feb 2014 23:03:10 +0000 (00:03 +0100)
commit151b9b9662a90455262ce575a8a8ae74bf4ff336
tree3e82f3233050d75d23fd69bfdd83aa850727395a
parent3db729cb8e6822114e9323f4041dcdc080f2fb3c
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.
81 files changed:
src/bus-driverd/bus-driverd.c
src/bus-proxyd/bus-proxyd.c
src/core/automount.c
src/core/busname.c
src/core/dbus-job.c
src/core/dbus-manager.c
src/core/dbus-scope.c
src/core/dbus-unit.c
src/core/dbus.c
src/core/device.c
src/core/job.c
src/core/loopback-setup.c
src/core/manager.c
src/core/mount.c
src/core/path.c
src/core/scope.c
src/core/service.c
src/core/socket.c
src/core/swap.c
src/core/timer.c
src/journal/journald-kmsg.c
src/journal/journald-native.c
src/journal/journald-server.c
src/journal/journald-stream.c
src/journal/journald-syslog.c
src/libsystemd-dhcp/sd-dhcp-client.c
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-convenience.c
src/libsystemd/sd-bus/bus-creds.c
src/libsystemd/sd-bus/bus-kernel.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/bus-objects.c
src/libsystemd/sd-bus/bus-util.c
src/libsystemd/sd-bus/busctl.c
src/libsystemd/sd-bus/sd-bus.c
src/libsystemd/sd-bus/sd-memfd.c
src/libsystemd/sd-bus/test-bus-chat.c
src/libsystemd/sd-bus/test-bus-cleanup.c
src/libsystemd/sd-bus/test-bus-creds.c
src/libsystemd/sd-bus/test-bus-gvariant.c
src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
src/libsystemd/sd-bus/test-bus-kernel.c
src/libsystemd/sd-bus/test-bus-marshal.c
src/libsystemd/sd-bus/test-bus-match.c
src/libsystemd/sd-bus/test-bus-memfd.c
src/libsystemd/sd-bus/test-bus-server.c
src/libsystemd/sd-bus/test-bus-zero-copy.c
src/libsystemd/sd-event/sd-event.c
src/libsystemd/sd-event/test-event.c
src/libsystemd/sd-resolve/sd-resolve.c
src/libsystemd/sd-resolve/test-resolve.c
src/libsystemd/sd-rtnl/rtnl-message.c
src/libsystemd/sd-rtnl/rtnl-util.c
src/libsystemd/sd-rtnl/sd-rtnl.c
src/libsystemd/sd-rtnl/test-rtnl.c
src/locale/localectl.c
src/locale/localed.c
src/login/logind-button.c
src/login/logind-dbus.c
src/login/logind-inhibit.c
src/login/logind-session-device.c
src/login/logind-session.c
src/login/logind.c
src/machine/machined-dbus.c
src/network/networkd-address.c
src/network/networkd-link.c
src/network/networkd-manager.c
src/network/networkd-netdev.c
src/network/networkd-route.c
src/nspawn/nspawn.c
src/run/run.c
src/socket-proxy/socket-proxyd.c
src/systemctl/systemctl.c
src/systemd/sd-bus.h
src/systemd/sd-event.h
src/systemd/sd-journal.h
src/systemd/sd-memfd.h
src/systemd/sd-resolve.h
src/systemd/sd-rtnl.h
src/udev/net/link-config.c
src/udev/udev-event.c