aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Sergei Trofimovich <slyich@gmail.com>2023-11-03 12:17:39 +0000
committerLibravatar Simon Ser <contact@emersion.fr>2023-11-03 13:25:27 +0100
commit020a572ed615b8fe272c7566a27ee0abe73a58d7 (patch)
treecde2646b4189b7c8bac9c73d255165242f358f3b
parentchase wlroots!4411 (diff)
downloadsway-020a572ed615b8fe272c7566a27ee0abe73a58d7.tar.gz
sway-020a572ed615b8fe272c7566a27ee0abe73a58d7.tar.zst
sway-020a572ed615b8fe272c7566a27ee0abe73a58d7.zip
swaynag/config.c: fix build against gcc-14 (-Walloc-size)
`gcc-14` added a new `-Walloc-size` warning that makes sure that size of an individual element matches size of a pointed type: https://gcc.gnu.org/PR71219 `sway` triggers it on `calloc()` calls where member size is used as `1` (instead of member count): swaynag/config.c:169:65: error: allocation of insufficient size '1' for type 'struct swaynag_button' with size '48' [-Werror=alloc-size] 169 | struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1);
-rw-r--r--swaynag/config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/swaynag/config.c b/swaynag/config.c
index 6d39f342..cff3930f 100644
--- a/swaynag/config.c
+++ b/swaynag/config.c
@@ -166,7 +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 = calloc(sizeof(struct swaynag_button), 1); 169 struct swaynag_button *button = calloc(1, sizeof(struct swaynag_button));
170 if (!button) { 170 if (!button) {
171 perror("calloc"); 171 perror("calloc");
172 return EXIT_FAILURE; 172 return EXIT_FAILURE;