void-packages/srcpkgs/wtype/patches/fix_reallocarray.patch
2021-11-14 13:50:16 +01:00

34 lines
856 B
Diff

From fb8cb526470308d36b28c33620fcb74916f952e8 Mon Sep 17 00:00:00 2001
From: Josef Gajdusek <atx@atx.name>
Date: Mon, 28 Dec 2020 20:45:36 +0100
Subject: [PATCH] Do not use reallocarray
Not available in musl.
Closes #20
---
main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/main.c b/main.c
index cbdbb0f..cec1cc2 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,4 @@
-#define _GNU_SOURCE
-
#include <fcntl.h>
#include <locale.h>
#include <stdbool.h>
@@ -140,8 +138,8 @@ unsigned int get_key_code(struct wtype *wtype, wchar_t ch)
return i;
}
}
- wtype->keymap = reallocarray(
- wtype->keymap, ++wtype->keymap_len, sizeof(wtype->keymap[0])
+ wtype->keymap = realloc(
+ wtype->keymap, ++wtype->keymap_len * sizeof(wtype->keymap[0])
);
wtype->keymap[wtype->keymap_len - 1] = ch;
return wtype->keymap_len - 1;