Remove a couple more uses of static char buffers Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/src/text.c b/src/text.c
index 39fa83e..2d5cefb 100644
--- a/src/text.c
+++ b/src/text.c
@@ -288,10 +288,8 @@ ActionTypeText(unsigned type)
const char *
KeysymText(struct xkb_context *ctx, xkb_keysym_t sym)
{
- static char buffer[64];
-
- xkb_keysym_get_name(sym, buffer, sizeof buffer);
-
+ char *buffer = xkb_context_get_buffer(ctx, 64);
+ xkb_keysym_get_name(sym, buffer, 64);
return buffer;
}
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 9aca92f..fb654a6 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -271,15 +271,16 @@ typedef struct {
static const char *
siText(SymInterpInfo *si, CompatInfo *info)
{
- static char buf[128];
+ char *buf = xkb_context_get_buffer(info->keymap->ctx, 128);
if (si == &info->dflt)
return "default";
- snprintf(buf, sizeof(buf), "%s+%s(%s)",
+ snprintf(buf, 128, "%s+%s(%s)",
KeysymText(info->keymap->ctx, si->interp.sym),
SIMatchText(si->interp.match),
ModMaskText(info->keymap, si->interp.mods));
+
return buf;
}