aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorD.B <thejan.2009@gmail.com>2016-11-03 06:43:12 +0100
committerD.B <thejan.2009@gmail.com>2016-11-03 06:43:12 +0100
commit3d1b472b8312ec212b82b9a5c34af40272e9d995 (patch)
treeee822e5e219275c84446709c349de630d7441055 /sway/config.c
parent58eb7ac19fe436737babcbd1effd41ef96af6632 (diff)
swap unnecessary function for strndup
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/sway/config.c b/sway/config.c
index d790afa2..7d5999d8 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -1131,12 +1131,6 @@ struct sway_binding *sway_binding_dup(struct sway_binding *sb) {
return new_sb;
}
-static void set_bar_color(char **name, char *value) {
- // every color has 9 characters plus \0
- *name = malloc(10);
- strcpy(*name, value);
-}
-
struct bar_config *default_bar_config(void) {
struct bar_config *bar = NULL;
bar = malloc(sizeof(struct bar_config));
@@ -1160,22 +1154,23 @@ struct bar_config *default_bar_config(void) {
bar->verbose = false;
bar->pid = 0;
// set default colors
- set_bar_color(&(bar->colors.background), "#000000ff");
- set_bar_color(&(bar->colors.statusline), "#ffffffff");
- set_bar_color(&(bar->colors.separator), "#666666ff");
- set_bar_color(&(bar->colors.focused_workspace_border), "#4c7899ff");
- set_bar_color(&(bar->colors.focused_workspace_bg), "#285577ff");
- set_bar_color(&(bar->colors.focused_workspace_text), "#ffffffff");
- set_bar_color(&(bar->colors.active_workspace_border), "#333333ff");
- set_bar_color(&(bar->colors.active_workspace_bg), "#5f676aff");
- set_bar_color(&(bar->colors.active_workspace_text), "#ffffffff");
- set_bar_color(&(bar->colors.inactive_workspace_border), "#333333ff");
- set_bar_color(&(bar->colors.inactive_workspace_bg),"#222222ff");
- set_bar_color(&(bar->colors.inactive_workspace_text), "#888888ff");
- set_bar_color(&(bar->colors.urgent_workspace_border), "#2f343aff");
- set_bar_color(&(bar->colors.urgent_workspace_bg),"#900000ff");
- set_bar_color(&(bar->colors.urgent_workspace_text), "#ffffffff");
-
+ bar->colors.background = strndup("#000000ff", 9);
+ bar->colors.statusline = strndup("#ffffffff", 9);
+ bar->colors.separator = strndup("#666666ff", 9);
+ bar->colors.focused_workspace_border = strndup("#4c7899ff", 9);
+ bar->colors.focused_workspace_bg = strndup("#285577ff", 9);
+ bar->colors.focused_workspace_text = strndup("#ffffffff", 9);
+ bar->colors.active_workspace_border = strndup("#333333ff", 9);
+ bar->colors.active_workspace_bg = strndup("#5f676aff", 9);
+ bar->colors.active_workspace_text = strndup("#ffffffff", 9);
+ bar->colors.inactive_workspace_border = strndup("#333333ff", 9);
+ bar->colors.inactive_workspace_bg = strndup("#222222ff", 9);
+ bar->colors.inactive_workspace_text = strndup("#888888ff", 9);
+ bar->colors.urgent_workspace_border = strndup("#2f343aff", 9);
+ bar->colors.urgent_workspace_bg = strndup("#900000ff", 9);
+ bar->colors.urgent_workspace_text = strndup("#ffffffff", 9);
+ // if the following colors stay undefined, they fall back to background,
+ // statusline, separator and urgent_workspace_*.
bar->colors.focused_background = NULL;
bar->colors.focused_statusline = NULL;
bar->colors.focused_separator = NULL;