aboutsummaryrefslogtreecommitdiff
path: root/ncurses/widechar/lib_key_name.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2020-02-07 08:36:41 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2020-02-07 08:36:41 +0000
commitf0179cb6083cc92e5947ae56e6a0a5c5328aead0 (patch)
treebcee0ba9c2149b71f0bfc036df1e61e3105bf980 /ncurses/widechar/lib_key_name.c
parentcea297eb34d2361e79529034397465068ae34ecd (diff)
downloadsrc-f0179cb6083cc92e5947ae56e6a0a5c5328aead0.tar.gz
src-f0179cb6083cc92e5947ae56e6a0a5c5328aead0.zip
Vendor import ncurses 6.1-20200118vendor/ncurses/6.1-20200118
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=357645 svn path=/vendor/ncurses/6.1-20200118/; revision=357646; tag=vendor/ncurses/6.1-20200118
Diffstat (limited to 'ncurses/widechar/lib_key_name.c')
-rw-r--r--ncurses/widechar/lib_key_name.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ncurses/widechar/lib_key_name.c b/ncurses/widechar/lib_key_name.c
index da65f219c266..daf4ab022ae9 100644
--- a/ncurses/widechar/lib_key_name.c
+++ b/ncurses/widechar/lib_key_name.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2007,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -35,7 +35,9 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_key_name.c,v 1.3 2008/10/11 20:15:14 tom Exp $")
+MODULE_ID("$Id: lib_key_name.c,v 1.4 2017/01/07 19:50:17 tom Exp $")
+
+#define MyData _nc_globals.key_name
NCURSES_EXPORT(NCURSES_CONST char *)
key_name(wchar_t c)
@@ -44,19 +46,16 @@ key_name(wchar_t c)
wchar_t *my_wchars;
size_t len;
- /* FIXME: move to _nc_globals */
- static char result[MB_LEN_MAX + 1];
-
memset(&my_cchar, 0, sizeof(my_cchar));
my_cchar.chars[0] = c;
my_cchar.chars[1] = L'\0';
my_wchars = wunctrl(&my_cchar);
- len = wcstombs(result, my_wchars, sizeof(result) - 1);
+ len = wcstombs(MyData, my_wchars, sizeof(MyData) - 1);
if (isEILSEQ(len) || (len == 0)) {
return 0;
}
- result[len] = '\0';
- return result;
+ MyData[len] = '\0';
+ return MyData;
}