aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Nihal Jere <nihal@nihaljere.xyz>2022-03-20 13:00:11 -0500
committerLibravatar Simon Ser <contact@emersion.fr>2022-05-07 15:57:18 +0200
commitc85d9af2b6ee0478ffc21f3970280c5be6d9b925 (patch)
treeede131f68a3ec70260da5d1cd4a601c4eb49b171
parentswaynag: improve robustness when loading config (diff)
downloadsway-c85d9af2b6ee0478ffc21f3970280c5be6d9b925.tar.gz
sway-c85d9af2b6ee0478ffc21f3970280c5be6d9b925.tar.zst
sway-c85d9af2b6ee0478ffc21f3970280c5be6d9b925.zip
swaynag: combine consecutive declaration/assignments
-rw-r--r--swaynag/config.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/swaynag/config.c b/swaynag/config.c
index ac5f31c0..9aeec3c2 100644
--- a/swaynag/config.c
+++ b/swaynag/config.c
@@ -166,8 +166,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
166 fprintf(stderr, "Missing action for button %s\n", optarg); 166 fprintf(stderr, "Missing action for button %s\n", optarg);
167 return EXIT_FAILURE; 167 return EXIT_FAILURE;
168 } 168 }
169 struct swaynag_button *button; 169 struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1);
170 button = calloc(sizeof(struct swaynag_button), 1);
171 if (!button) { 170 if (!button) {
172 perror("calloc"); 171 perror("calloc");
173 return EXIT_FAILURE; 172 return EXIT_FAILURE;
@@ -262,8 +261,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
262 break; 261 break;
263 case 's': // Dismiss Button Text 262 case 's': // Dismiss Button Text
264 if (swaynag) { 263 if (swaynag) {
265 struct swaynag_button *button_close; 264 struct swaynag_button *button_close = swaynag->buttons->items[0];
266 button_close = swaynag->buttons->items[0];
267 free(button_close->text); 265 free(button_close->text);
268 button_close->text = strdup(optarg); 266 button_close->text = strdup(optarg);
269 } 267 }