summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-10-23 12:50:30 +0200
committerLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-10-23 12:55:48 +0200
commit88a2ddbe83347c98dcd4bd20f6945e4923ea74ef (patch)
treeff58f1b91840e4ca771b1d6e3a7b412e750bf0f3
parentcommands: Allow 'floating_modifier' & 'focus_follows_mouse' at runtime. (diff)
downloadsway-88a2ddbe83347c98dcd4bd20f6945e4923ea74ef.tar.gz
sway-88a2ddbe83347c98dcd4bd20f6945e4923ea74ef.tar.zst
sway-88a2ddbe83347c98dcd4bd20f6945e4923ea74ef.zip
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
1329} 1329}
1330 1330
1331void free_cmd_results(struct cmd_results *results) { 1331void free_cmd_results(struct cmd_results *results) {
1332 if (results->error) 1332 if (results->error) {
1333 free(results->error); 1333 free(results->error);
1334 }
1334 free(results); 1335 free(results);
1335} 1336}
1336 1337
1337const char *cmd_results_to_json(struct cmd_results *results) { 1338const char *cmd_results_to_json(struct cmd_results *results) {
1338 json_object *root = json_object_new_object(); 1339 json_object *root = json_object_new_object();
1339 json_object_object_add(root, "success", json_object_new_boolean(results->status == CMD_SUCCESS)); 1340 json_object_object_add(root, "success", json_object_new_boolean(results->status == CMD_SUCCESS));
1340 if (results->input) 1341 if (results->input) {
1341 json_object_object_add(root, "input", json_object_new_string(results->input)); 1342 json_object_object_add(root, "input", json_object_new_string(results->input));
1342 if (results->error) 1343 }
1344 if (results->error) {
1343 json_object_object_add(root, "error", json_object_new_string(results->error)); 1345 json_object_object_add(root, "error", json_object_new_string(results->error));
1344 1346 }
1345 const char *json = json_object_to_json_string(root); 1347 const char *json = json_object_to_json_string(root);
1346 free(root); 1348 free(root);
1347 return json; 1349 return json;