From b53db6f005b6a7d3b27a96a581dec7fdfe5b6d58 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sun, 26 Jun 2022 19:50:32 +0200 Subject: Deprecate memset(3) over C99 compound literals for zero-init Using memset(3) does not ensure pointers are assigned to NULL for all platforms. --- src/keyboard/src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/keyboard') diff --git a/src/keyboard/src/keyboard.c b/src/keyboard/src/keyboard.c index c247b16..958ac65 100644 --- a/src/keyboard/src/keyboard.c +++ b/src/keyboard/src/keyboard.c @@ -53,7 +53,7 @@ bool keyboard_justpressed(const struct keyboard *const k, void keyboard_init(struct keyboard *const k) { - memset(k, 0, sizeof *k); + *k = (const struct keyboard){0}; } const char *keyboard_key_str(const enum keyboard_key k) -- cgit v1.2.3