From cb07434913b89580a4025824cb181733b2db1eb7 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 1 May 2018 22:48:57 +1000 Subject: [PATCH] Remove unnecessary pointers --- sway/commands/client.c | 20 ++++++------ sway/config.c | 74 +++++++++++++++++++++--------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/sway/commands/client.c b/sway/commands/client.c index ce519381..156ff95c 100644 --- a/sway/commands/client.c +++ b/sway/commands/client.c @@ -3,7 +3,7 @@ #include "sway/config.h" #include "sway/tree/container.h" -static bool parse_color(char *hexstring, float (*dest)[4]) { +static bool parse_color(char *hexstring, float dest[static 4]) { if (hexstring[0] != '#') { return false; } @@ -20,10 +20,10 @@ static bool parse_color(char *hexstring, float (*dest)[4]) { return false; } - (*dest)[0] = ((decimal >> 16) & 0xff) / 255.0; - (*dest)[1] = ((decimal >> 8) & 0xff) / 255.0; - (*dest)[2] = (decimal & 0xff) / 255.0; - (*dest)[3] = 1.0; + dest[0] = ((decimal >> 16) & 0xff) / 255.0; + dest[1] = ((decimal >> 8) & 0xff) / 255.0; + dest[2] = (decimal & 0xff) / 255.0; + dest[3] = 1.0; return true; } @@ -34,27 +34,27 @@ static struct cmd_results *handle_command(int argc, char **argv, return error; } - if (!parse_color(argv[0], &class->border)) { + if (!parse_color(argv[0], class->border)) { return cmd_results_new(CMD_INVALID, cmd_name, "Unable to parse border color"); } - if (!parse_color(argv[1], &class->background)) { + if (!parse_color(argv[1], class->background)) { return cmd_results_new(CMD_INVALID, cmd_name, "Unable to parse background color"); } - if (!parse_color(argv[2], &class->text)) { + if (!parse_color(argv[2], class->text)) { return cmd_results_new(CMD_INVALID, cmd_name, "Unable to parse text color"); } - if (!parse_color(argv[3], &class->indicator)) { + if (!parse_color(argv[3], class->indicator)) { return cmd_results_new(CMD_INVALID, cmd_name, "Unable to parse indicator color"); } - if (!parse_color(argv[4], &class->child_border)) { + if (!parse_color(argv[4], class->child_border)) { return cmd_results_new(CMD_INVALID, cmd_name, "Unable to parse child border color"); } diff --git a/sway/config.c b/sway/config.c index ed291450..f4d78e19 100644 --- a/sway/config.c +++ b/sway/config.c @@ -130,11 +130,11 @@ static void destroy_removed_seats(struct sway_config *old_config, } } -static void set_color(float (*dest)[4], uint32_t color) { - (*dest)[0] = ((color >> 16) & 0xff) / 255.0; - (*dest)[1] = ((color >> 8) & 0xff) / 255.0; - (*dest)[2] = (color & 0xff) / 255.0; - (*dest)[3] = 1.0; +static void set_color(float dest[static 4], uint32_t color) { + dest[0] = ((color >> 16) & 0xff) / 255.0; + dest[1] = ((color >> 8) & 0xff) / 255.0; + dest[2] = (color & 0xff) / 255.0; + dest[3] = 1.0; } static void config_defaults(struct sway_config *config) { @@ -205,38 +205,38 @@ static void config_defaults(struct sway_config *config) { config->hide_edge_borders = E_NONE; // border colors - set_color(&config->border_colors.focused.border, 0x4C7899); - set_color(&config->border_colors.focused.border, 0x4C7899); - set_color(&config->border_colors.focused.background, 0x285577); - set_color(&config->border_colors.focused.text, 0xFFFFFF); - set_color(&config->border_colors.focused.indicator, 0x2E9EF4); - set_color(&config->border_colors.focused.child_border, 0x285577); - - set_color(&config->border_colors.focused_inactive.border, 0x333333); - set_color(&config->border_colors.focused_inactive.background, 0x5F676A); - set_color(&config->border_colors.focused_inactive.text, 0xFFFFFF); - set_color(&config->border_colors.focused_inactive.indicator, 0x484E50); - set_color(&config->border_colors.focused_inactive.child_border, 0x5F676A); - - set_color(&config->border_colors.unfocused.border, 0x333333); - set_color(&config->border_colors.unfocused.background, 0x222222); - set_color(&config->border_colors.unfocused.text, 0x888888); - set_color(&config->border_colors.unfocused.indicator, 0x292D2E); - set_color(&config->border_colors.unfocused.child_border, 0x222222); - - set_color(&config->border_colors.urgent.border, 0x2F343A); - set_color(&config->border_colors.urgent.background, 0x900000); - set_color(&config->border_colors.urgent.text, 0xFFFFFF); - set_color(&config->border_colors.urgent.indicator, 0x900000); - set_color(&config->border_colors.urgent.child_border, 0x900000); - - set_color(&config->border_colors.placeholder.border, 0x000000); - set_color(&config->border_colors.placeholder.background, 0x0C0C0C); - set_color(&config->border_colors.placeholder.text, 0xFFFFFF); - set_color(&config->border_colors.placeholder.indicator, 0x000000); - set_color(&config->border_colors.placeholder.child_border, 0x0C0C0C); - - set_color(&config->border_colors.background, 0xFFFFFF); + set_color(config->border_colors.focused.border, 0x4C7899); + set_color(config->border_colors.focused.border, 0x4C7899); + set_color(config->border_colors.focused.background, 0x285577); + set_color(config->border_colors.focused.text, 0xFFFFFF); + set_color(config->border_colors.focused.indicator, 0x2E9EF4); + set_color(config->border_colors.focused.child_border, 0x285577); + + set_color(config->border_colors.focused_inactive.border, 0x333333); + set_color(config->border_colors.focused_inactive.background, 0x5F676A); + set_color(config->border_colors.focused_inactive.text, 0xFFFFFF); + set_color(config->border_colors.focused_inactive.indicator, 0x484E50); + set_color(config->border_colors.focused_inactive.child_border, 0x5F676A); + + set_color(config->border_colors.unfocused.border, 0x333333); + set_color(config->border_colors.unfocused.background, 0x222222); + set_color(config->border_colors.unfocused.text, 0x888888); + set_color(config->border_colors.unfocused.indicator, 0x292D2E); + set_color(config->border_colors.unfocused.child_border, 0x222222); + + set_color(config->border_colors.urgent.border, 0x2F343A); + set_color(config->border_colors.urgent.background, 0x900000); + set_color(config->border_colors.urgent.text, 0xFFFFFF); + set_color(config->border_colors.urgent.indicator, 0x900000); + set_color(config->border_colors.urgent.child_border, 0x900000); + + set_color(config->border_colors.placeholder.border, 0x000000); + set_color(config->border_colors.placeholder.background, 0x0C0C0C); + set_color(config->border_colors.placeholder.text, 0xFFFFFF); + set_color(config->border_colors.placeholder.indicator, 0x000000); + set_color(config->border_colors.placeholder.child_border, 0x0C0C0C); + + set_color(config->border_colors.background, 0xFFFFFF); // Security if (!(config->command_policies = create_list())) goto cleanup;