state: fix -Walloc-size

GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/state.c:589:9: warning: allocation of insufficient size ‘1’ for type ‘struct xkb_state’ with size ‘128’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct xkb_state)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
master
Sam James 2023-11-05 22:06:40 +00:00 committed by Peter Hutterer
parent 3aaa4e2a53
commit fed96378a1
1 changed files with 1 additions and 1 deletions

View File

@ -586,7 +586,7 @@ xkb_state_new(struct xkb_keymap *keymap)
{ {
struct xkb_state *ret; struct xkb_state *ret;
ret = calloc(sizeof(*ret), 1); ret = calloc(1, sizeof(*ret));
if (!ret) if (!ret)
return NULL; return NULL;