summaryrefslogtreecommitdiff
path: root/src/socket-proxy
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/socket-proxy
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/socket-proxy')
-rw-r--r--src/socket-proxy/socket-proxyd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index b066633b1d..a42e5ae279 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -318,7 +318,7 @@ static int connection_enable_event_sources(Connection *c, sd_event *event) {
if (c->server_event_source)
r = sd_event_source_set_io_events(c->server_event_source, a);
else if (c->server_fd >= 0)
- r = sd_event_add_io(event, c->server_fd, a, traffic_cb, c, &c->server_event_source);
+ r = sd_event_add_io(event, &c->server_event_source, c->server_fd, a, traffic_cb, c);
else
r = 0;
@@ -330,7 +330,7 @@ static int connection_enable_event_sources(Connection *c, sd_event *event) {
if (c->client_event_source)
r = sd_event_source_set_io_events(c->client_event_source, b);
else if (c->client_fd >= 0)
- r = sd_event_add_io(event, c->client_fd, b, traffic_cb, c, &c->client_event_source);
+ r = sd_event_add_io(event, &c->client_event_source, c->client_fd, b, traffic_cb, c);
else
r = 0;
@@ -433,7 +433,7 @@ static int add_connection_socket(Context *context, sd_event *event, int fd) {
r = connect(c->client_fd, &sa.sa, salen);
if (r < 0) {
if (errno == EINPROGRESS) {
- r = sd_event_add_io(event, c->client_fd, EPOLLOUT, connect_cb, c, &c->client_event_source);
+ r = sd_event_add_io(event, &c->client_event_source, c->client_fd, EPOLLOUT, connect_cb, c);
if (r < 0) {
log_error("Failed to add connection socket: %s", strerror(-r));
goto fail;
@@ -526,7 +526,7 @@ static int add_listen_socket(Context *context, sd_event *event, int fd) {
return r;
}
- r = sd_event_add_io(event, fd, EPOLLIN, accept_cb, context, &source);
+ r = sd_event_add_io(event, &source, fd, EPOLLIN, accept_cb, context);
if (r < 0) {
log_error("Failed to add event source: %s", strerror(-r));
return r;