diff options
Diffstat (limited to 'swaynag/config.c')
-rw-r--r-- | swaynag/config.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/swaynag/config.c b/swaynag/config.c index a0bf3197..efd71ce7 100644 --- a/swaynag/config.c +++ b/swaynag/config.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
2 | #include <getopt.h> | 1 | #include <getopt.h> |
3 | #include <stdio.h> | 2 | #include <stdio.h> |
4 | #include <stdlib.h> | 3 | #include <stdlib.h> |
@@ -166,7 +165,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
166 | fprintf(stderr, "Missing action for button %s\n", optarg); | 165 | fprintf(stderr, "Missing action for button %s\n", optarg); |
167 | return EXIT_FAILURE; | 166 | return EXIT_FAILURE; |
168 | } | 167 | } |
169 | struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1); | 168 | struct swaynag_button *button = calloc(1, sizeof(struct swaynag_button)); |
170 | if (!button) { | 169 | if (!button) { |
171 | perror("calloc"); | 170 | perror("calloc"); |
172 | return EXIT_FAILURE; | 171 | return EXIT_FAILURE; |
@@ -226,10 +225,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
226 | break; | 225 | break; |
227 | case 'f': // Font | 226 | case 'f': // Font |
228 | if (type) { | 227 | if (type) { |
229 | free(type->font); | ||
230 | pango_font_description_free(type->font_description); | 228 | pango_font_description_free(type->font_description); |
231 | type->font = strdup(optarg); | 229 | type->font_description = pango_font_description_from_string(optarg); |
232 | type->font_description = pango_font_description_from_string(type->font); | ||
233 | } | 230 | } |
234 | break; | 231 | break; |
235 | case 'l': // Detailed Message | 232 | case 'l': // Detailed Message |
@@ -245,8 +242,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
245 | break; | 242 | break; |
246 | case 'L': // Detailed Button Text | 243 | case 'L': // Detailed Button Text |
247 | if (swaynag) { | 244 | if (swaynag) { |
248 | free(swaynag->details.button_details.text); | 245 | free(swaynag->details.details_text); |
249 | swaynag->details.button_details.text = strdup(optarg); | 246 | swaynag->details.details_text = strdup(optarg); |
250 | } | 247 | } |
251 | break; | 248 | break; |
252 | case 'm': // Message | 249 | case 'm': // Message |