From 5b79487ab8e8284bbb4125945ad662e639553b33 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 4 Nov 2018 16:45:23 +0100 Subject: [PATCH] Format with uncrustify --- src/rpc.c | 15 +++++++++------ src/timespec.c | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/rpc.c b/src/rpc.c index 08b5ad9..d83ac23 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -126,7 +126,8 @@ static void rpc_channel_set_handler(struct mg_rpc_request_info *ri, void *cb_arg static void rpc_timespec_get_handler(struct mg_rpc_request_info *ri, void *cb_arg, struct mg_rpc_frame_info *fi, struct mg_str args) { struct mgos_timespec *ts; char buf[200]; - int idx; + int idx; + rpc_log(ri, args); json_scanf(args.p, args.len, ri->args_fmt, &idx); @@ -135,7 +136,7 @@ static void rpc_timespec_get_handler(struct mg_rpc_request_info *ri, void *cb_ar ri = NULL; return; } - ts=channel_get_timespec(idx); + ts = channel_get_timespec(idx); if (!ts) { mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx); ri = NULL; @@ -166,7 +167,7 @@ static void rpc_timespec_clear_handler(struct mg_rpc_request_info *ri, void *cb_ ri = NULL; return; } - ts=channel_get_timespec(idx); + ts = channel_get_timespec(idx); if (!ts) { mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx); ri = NULL; @@ -189,7 +190,7 @@ static void rpc_timespec_clear_handler(struct mg_rpc_request_info *ri, void *cb_ static void rpc_timespec_add_handler(struct mg_rpc_request_info *ri, void *cb_arg, struct mg_rpc_frame_info *fi, struct mg_str args) { struct mgos_timespec *ts; - int idx; + int idx; char *spec = NULL; rpc_log(ri, args); @@ -200,7 +201,7 @@ static void rpc_timespec_add_handler(struct mg_rpc_request_info *ri, void *cb_ar ri = NULL; goto exit; } - ts=channel_get_timespec(idx); + ts = channel_get_timespec(idx); if (!ts) { mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx); ri = NULL; @@ -217,7 +218,9 @@ static void rpc_timespec_add_handler(struct mg_rpc_request_info *ri, void *cb_ar ri = NULL; exit: - if (spec) free(spec); + if (spec) { + free(spec); + } (void)cb_arg; (void)fi; } diff --git a/src/timespec.c b/src/timespec.c index a4b2ea6..4599d79 100644 --- a/src/timespec.c +++ b/src/timespec.c @@ -240,7 +240,7 @@ bool timespec_get_spec(struct mgos_timespec *ts, char *ret, int retlen) { snprintf(spec_str, sizeof(spec_str) - 1, "%02d:%02d:%02d-%02d:%02d:%02d", t_spec->start_h, t_spec->start_m, t_spec->start_s, t_spec->stop_h, t_spec->stop_m, t_spec->stop_s); - if ((int) (strlen(spec_str) + strlen(ret)) > retlen - 1) { + if ((int)(strlen(spec_str) + strlen(ret)) > retlen - 1) { return false; } if (strlen(ret) > 0) {