aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS. Christoffer Eliesen <christoffer@eliesen.no>2015-10-23 12:50:30 +0200
committerS. Christoffer Eliesen <christoffer@eliesen.no>2015-10-23 12:55:48 +0200
commit88a2ddbe83347c98dcd4bd20f6945e4923ea74ef (patch)
treeff58f1b91840e4ca771b1d6e3a7b412e750bf0f3
parent187f0ab1c4d24cf64d5db2b1ecf09b08b5a58c7a (diff)
commands: Code formatting.
-rw-r--r--sway/commands.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 50a6e941..d742495d 100644
--- 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;