mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
api: cleanup return code style in API actions
This commit is contained in:
parent
bccdcb89cb
commit
3f9c58fbe5
3 changed files with 7 additions and 7 deletions
|
@ -50,7 +50,7 @@ public:
|
|||
ret = json_unpack_ex(args, &err, 0, "{ s: s }",
|
||||
"node", &node_str
|
||||
);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
struct vlist *nodes = session->getSuperNode()->getNodes();
|
||||
|
|
|
@ -66,10 +66,8 @@ public:
|
|||
|
||||
if (args) {
|
||||
ret = json_unpack_ex(args, &err, 0, "{ s?: s }", "config", &cfg);
|
||||
if (ret < 0) {
|
||||
*resp = json_string("failed to parse request");
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* If no config is provided via request, we will use the previous one */
|
||||
|
@ -98,7 +96,7 @@ public:
|
|||
/* Register exit handler */
|
||||
ret = atexit(handler);
|
||||
if (ret)
|
||||
return 0;
|
||||
return ret;
|
||||
|
||||
/* Properly terminate current instance */
|
||||
killme(SIGTERM);
|
||||
|
|
|
@ -42,10 +42,12 @@ public:
|
|||
char buf[4096];
|
||||
|
||||
ret = lws_json_dump_context(ctx, buf, sizeof(buf), 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*resp = json_loads(buf, 0, nullptr);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue