Remove a couple more uses of static char buffers

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-10-18 22:55:17 +02:00
parent 714e95e144
commit e6946ae2c5
2 changed files with 5 additions and 6 deletions

View File

@ -288,10 +288,8 @@ ActionTypeText(unsigned type)
const char * const char *
KeysymText(struct xkb_context *ctx, xkb_keysym_t sym) KeysymText(struct xkb_context *ctx, xkb_keysym_t sym)
{ {
static char buffer[64]; char *buffer = xkb_context_get_buffer(ctx, 64);
xkb_keysym_get_name(sym, buffer, 64);
xkb_keysym_get_name(sym, buffer, sizeof buffer);
return buffer; return buffer;
} }

View File

@ -271,15 +271,16 @@ typedef struct {
static const char * static const char *
siText(SymInterpInfo *si, CompatInfo *info) siText(SymInterpInfo *si, CompatInfo *info)
{ {
static char buf[128]; char *buf = xkb_context_get_buffer(info->keymap->ctx, 128);
if (si == &info->dflt) if (si == &info->dflt)
return "default"; return "default";
snprintf(buf, sizeof(buf), "%s+%s(%s)", snprintf(buf, 128, "%s+%s(%s)",
KeysymText(info->keymap->ctx, si->interp.sym), KeysymText(info->keymap->ctx, si->interp.sym),
SIMatchText(si->interp.match), SIMatchText(si->interp.match),
ModMaskText(info->keymap, si->interp.mods)); ModMaskText(info->keymap, si->interp.mods));
return buf; return buf;
} }