Format with uncrustify
This commit is contained in:
15
src/rpc.c
15
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) {
|
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;
|
struct mgos_timespec *ts;
|
||||||
char buf[200];
|
char buf[200];
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
rpc_log(ri, args);
|
rpc_log(ri, args);
|
||||||
|
|
||||||
json_scanf(args.p, args.len, ri->args_fmt, &idx);
|
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;
|
ri = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ts=channel_get_timespec(idx);
|
ts = channel_get_timespec(idx);
|
||||||
if (!ts) {
|
if (!ts) {
|
||||||
mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx);
|
mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx);
|
||||||
ri = NULL;
|
ri = NULL;
|
||||||
@ -166,7 +167,7 @@ static void rpc_timespec_clear_handler(struct mg_rpc_request_info *ri, void *cb_
|
|||||||
ri = NULL;
|
ri = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ts=channel_get_timespec(idx);
|
ts = channel_get_timespec(idx);
|
||||||
if (!ts) {
|
if (!ts) {
|
||||||
mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx);
|
mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx);
|
||||||
ri = NULL;
|
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) {
|
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;
|
struct mgos_timespec *ts;
|
||||||
int idx;
|
int idx;
|
||||||
char *spec = NULL;
|
char *spec = NULL;
|
||||||
|
|
||||||
rpc_log(ri, args);
|
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;
|
ri = NULL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
ts=channel_get_timespec(idx);
|
ts = channel_get_timespec(idx);
|
||||||
if (!ts) {
|
if (!ts) {
|
||||||
mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx);
|
mg_rpc_send_errorf(ri, 400, "timespec on channel %d isn't set", idx);
|
||||||
ri = NULL;
|
ri = NULL;
|
||||||
@ -217,7 +218,9 @@ static void rpc_timespec_add_handler(struct mg_rpc_request_info *ri, void *cb_ar
|
|||||||
ri = NULL;
|
ri = NULL;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (spec) free(spec);
|
if (spec) {
|
||||||
|
free(spec);
|
||||||
|
}
|
||||||
(void)cb_arg;
|
(void)cb_arg;
|
||||||
(void)fi;
|
(void)fi;
|
||||||
}
|
}
|
||||||
|
@ -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,
|
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);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (strlen(ret) > 0) {
|
if (strlen(ret) > 0) {
|
||||||
|
Reference in New Issue
Block a user