aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mds-base.c26
-rw-r--r--src/mds-echo.c6
-rw-r--r--src/mds-kbdc/compile-layout.c5
3 files changed, 14 insertions, 23 deletions
diff --git a/src/mds-base.c b/src/mds-base.c
index 9b2db1a..a9a942b 100644
--- a/src/mds-base.c
+++ b/src/mds-base.c
@@ -36,9 +36,6 @@
#include <fcntl.h>
-#define try(INSTRUCTION) fail_if ((r = (INSTRUCTION)))
-
-
/**
* Number of elements in `argv`
*/
@@ -504,8 +501,6 @@ static void perform_reexec(void)
*/
int main(int argc_, char** argv_)
{
- int r = 1;
-
argc = argc_;
argv = argv_;
@@ -513,7 +508,7 @@ int main(int argc_, char** argv_)
if (server_characteristics.require_privileges == 0)
/* Drop privileges like it's hot. */
if (drop_privileges())
- fail_if ((r = 1));
+ fail_if (1);
/* Use /proc/self/exe when re:exec-ing */
@@ -526,7 +521,7 @@ int main(int argc_, char** argv_)
eprint("that number of arguments is ridiculous, I will not allow it."););
/* Parse command line arguments. */
- try (parse_cmdline());
+ fail_if (parse_cmdline());
/* Store the current thread so it can be killed from elsewhere. */
@@ -537,29 +532,29 @@ int main(int argc_, char** argv_)
/* Initialise the server. */
- try (preinitialise_server());
+ fail_if (preinitialise_server());
if (is_reexec == 0)
{
if (server_characteristics.require_display)
/* Connect to the display. */
- try (connect_to_display());
+ fail_if (connect_to_display());
/* Initialise the server. */
- try (initialise_server());
+ fail_if (initialise_server());
}
else
{
/* Unmarshal the server's saved state. */
- try (base_unmarshal());
+ fail_if (base_unmarshal());
}
/* Initialise the server. */
- try (postinitialise_server());
+ fail_if (postinitialise_server());
/* Run the server. */
- try (master_loop());
+ fail_if (master_loop());
/* Re-exec server if signal to re-exec. */
@@ -577,7 +572,7 @@ int main(int argc_, char** argv_)
xperror(*argv);
if (socket_fd >= 0)
close(socket_fd);
- return r;
+ return 1;
}
@@ -656,6 +651,3 @@ void __attribute__((weak)) fork_cleanup(int status)
fprintf(stderr, "Something is wrong, `fork_cleanup` has been called but not reimplemented.");
}
-
-#undef try
-
diff --git a/src/mds-echo.c b/src/mds-echo.c
index 09533fd..ab85c31 100644
--- a/src/mds-echo.c
+++ b/src/mds-echo.c
@@ -184,18 +184,16 @@ int marshal_server(char* state_buf)
*/
int unmarshal_server(char* state_buf)
{
- int r;
/* buf_get_next(state_buf, int, MDS_ECHO_VARS_VERSION); */
buf_next(state_buf, int, 1);
buf_get_next(state_buf, int, connected);
buf_get_next(state_buf, uint32_t, message_id);
- r = mds_message_unmarshal(&received, state_buf);
- fail_if (r);
+ fail_if (mds_message_unmarshal(&received, state_buf));
return 0;
fail:
xperror(*argv);
mds_message_destroy(&received);
- return r;
+ return -1;
}
diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c
index 539ade3..0df48eb 100644
--- a/src/mds-kbdc/compile-layout.c
+++ b/src/mds-kbdc/compile-layout.c
@@ -2500,10 +2500,9 @@ static int compile_macro_call(mds_kbdc_tree_macro_call_t* restrict tree)
*/
static int compile_subtree(mds_kbdc_tree_t* restrict tree)
{
-#define t(expr) if (r = (expr), r < 0) return r
+#define t(expr) fail_if ((expr) < 0)
#define c(type) t (compile_##type(&(tree->type)))
#define c_(type) t (compile_##type(&(tree->type##_)))
- int r;
again:
if (tree == NULL)
return 0;
@@ -2554,6 +2553,8 @@ static int compile_subtree(mds_kbdc_tree_t* restrict tree)
tree = tree->next;
goto again;
+ fail:
+ return -1;
#undef c_
#undef c
#undef t