aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server/mds-server.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-08 19:15:24 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-08 19:15:24 +0100
commite9880491796516b7e2f835a3df6f20e5da06ebf7 (patch)
treedc10120bd50d39aa092bea82c1143e5df845ee04 /src/mds-server/mds-server.c
parentreplace all variants of goto pfail with fail_if (diff)
downloadmds-e9880491796516b7e2f835a3df6f20e5da06ebf7.tar.gz
mds-e9880491796516b7e2f835a3df6f20e5da06ebf7.tar.bz2
mds-e9880491796516b7e2f835a3df6f20e5da06ebf7.tar.xz
no more goto fail
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-server/mds-server.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index f058396..499ba96 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -302,7 +302,7 @@ void* slave_loop(void* data)
if ((r == 0) && message_received(information))
goto terminate;
else if (r == -2)
- goto fail;
+ goto done;
else if (r && (errno == EINTR) && terminating)
goto terminate; /* Stop the thread if we are re-exec:ing or terminating the server. */
}
@@ -329,7 +329,7 @@ void* slave_loop(void* data)
if (reexecing)
goto reexec;
- fail: /* This done on success as well. */
+ done:
/* Close socket and free resources. */
close(slave_fd);
free(msgbuf);
@@ -350,7 +350,7 @@ void* slave_loop(void* data)
pfail:
xperror(*argv);
- goto fail;
+ goto done;
reexec:
@@ -482,22 +482,22 @@ void queue_message_multicast(char* message, size_t length, client_t* sender)
multicast->message_prefix = n;
message = NULL;
+#define pfail fail_in_mutex
/* Queue message multicasting. */
with_mutex (sender->mutex,
new_buf = sender->multicasts;
- if (xrealloc(new_buf, sender->multicasts_count + 1, multicast_t))
- {
- xperror(*argv);
- goto fail_queue;
- }
+ fail_if (xrealloc(new_buf, sender->multicasts_count + 1, multicast_t));
sender->multicasts = new_buf;
sender->multicasts[sender->multicasts_count++] = *multicast;
free(multicast);
multicast = NULL;
- fail_queue:
+ errno = 0;
+ fail_in_mutex:
+ xperror(*argv);
);
+#undef pfail
- fail: /* This is done before this function returns even if there was no error. */
+ done:
/* Release resources. */
xfree(headers, header_count);
xfree(header_values, header_count);
@@ -510,7 +510,7 @@ void queue_message_multicast(char* message, size_t length, client_t* sender)
pfail:
xperror(*argv);
- goto fail;
+ goto done;
}