commit 88a2ddbe83347c98dcd4bd20f6945e4923ea74ef
parent 187f0ab1c4d24cf64d5db2b1ecf09b08b5a58c7a
Author: S. Christoffer Eliesen <christoffer@eliesen.no>
Date: Fri, 23 Oct 2015 12:50:30 +0200
commands: Code formatting.
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sway/commands.c b/sway/commands.c
@@ -1329,19 +1329,21 @@ struct cmd_results *cmd_results_new(enum cmd_status status, const char* input, c
}
void free_cmd_results(struct cmd_results *results) {
- if (results->error)
+ if (results->error) {
free(results->error);
+ }
free(results);
}
const char *cmd_results_to_json(struct cmd_results *results) {
json_object *root = json_object_new_object();
json_object_object_add(root, "success", json_object_new_boolean(results->status == CMD_SUCCESS));
- if (results->input)
+ if (results->input) {
json_object_object_add(root, "input", json_object_new_string(results->input));
- if (results->error)
+ }
+ if (results->error) {
json_object_object_add(root, "error", json_object_new_string(results->error));
-
+ }
const char *json = json_object_to_json_string(root);
free(root);
return json;