From a4ad201025a0785b4fd18a2f8192370508de8691 Mon Sep 17 00:00:00 2001 From: Arie Peterson <arie@greenhost.nl> Date: Wed, 14 Jun 2017 15:39:30 +0200 Subject: [PATCH] More syntax improvements --- cryptops-api.c | 54 ++++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/cryptops-api.c b/cryptops-api.c index e75be96..e25c557 100644 --- a/cryptops-api.c +++ b/cryptops-api.c @@ -57,14 +57,8 @@ static int container_initialise int main(int argc, char **argv) { - y_init_logs - ( - "cryptops-api", - Y_LOG_MODE_CONSOLE, - Y_LOG_LEVEL_DEBUG, - NULL, - "Starting cryptops-api" - ); + y_init_logs("cryptops-api", Y_LOG_MODE_CONSOLE, Y_LOG_LEVEL_DEBUG, + NULL, "Starting cryptops-api"); struct _u_instance instance; if (ulfius_init_instance(&instance, PORT, NULL, NULL) != U_OK) @@ -79,16 +73,8 @@ int main(int argc, char **argv) instance.max_post_body_size = 1024; // Add api endpoints. - ulfius_add_endpoint_by_val - ( - &instance, - "POST", - PREFIX, - "/encryption/unlock", - 0, - &callback_encryption_unlock, - NULL - ); + ulfius_add_endpoint_by_val(&instance, "POST", PREFIX, "/encryption/unlock", + 0, &callback_encryption_unlock, NULL); // Add default endpoint. ulfius_set_default_endpoint(&instance, &callback_default, NULL); @@ -112,23 +98,13 @@ int main(int argc, char **argv) if (ret == U_OK) { - y_log_message - ( - Y_LOG_LEVEL_DEBUG, - "Start %sframework on port %d", - ((argc == 4 && strcmp("-secure", argv[1]) == 0)?"secure ":""), - instance.port - ); + y_log_message(Y_LOG_LEVEL_DEBUG, "Start %sframework on port %d", + ((argc == 4 && strcmp("-secure", argv[1]) == 0) ? "secure " : ""), + instance.port); // Wait for signal from fifo to quit. - y_init_logs - ( - "cryptops-api", - Y_LOG_MODE_CONSOLE, - Y_LOG_LEVEL_DEBUG, - NULL, - "Waiting for fifo signal to quit" - ); + y_init_logs("cryptops-api", Y_LOG_MODE_CONSOLE, Y_LOG_LEVEL_DEBUG, + NULL, "Waiting for fifo signal to quit"); int fifo = 0; char buf[4]; char fifo_path[] = FIFO_PATH; @@ -181,20 +157,16 @@ int callback_encryption_unlock if (unlock_status == -1) { // Experience learns that -1 is returned when the password is wrong. - return send_simple_response - ( - response, - 403, - "error", - "incorrect password" - ); + return send_simple_response(response, 403, "error", + "incorrect password"); } if (unlock_status != 0) { // Something else went wrong with unlocking. printf("encryption_unlock failed with status %d\n", unlock_status); - return send_simple_response(response, 500, "error", "error during unlocking"); + return send_simple_response(response, 500, "error", + "error during unlocking"); } // If we reach this point, apparently everything went well. -- GitLab