summaryrefslogtreecommitdiff
path: root/ext/tk
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-19 16:28:53 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-19 16:28:53 +0000
commit8302aa5f951e85984899d73fafa6bef2f23deddd (patch)
treee2d91c7eaadad662053210ef286ded8d89601f26 /ext/tk
parentb809254c8ce37ac996a7e0b2a9f27387cf7ee704 (diff)
merge revision(s) 44569:44572,44576:44579,44581,44590:44594,44607,44608,44614,44615:
iseq.c: linear search * iseq.c (iseq_type_from_id): linear search instead of hash lookup for small fixed number keys. ------------------------------------------------------------------------ r44570 | nobu | 2014-01-12 17:11:32 +0900 (Sun, 12 Jan 2014) | 4 lines tcltklib.c: create_ip_exc format argument * ext/tk/tcltklib.c (create_ip_exc): format argument must not be a dynamic string, not to contain unescaped %. ------------------------------------------------------------------------ r44571 | nobu | 2014-01-12 17:11:34 +0900 (Sun, 12 Jan 2014) | 5 lines stubs.c: library name strings * ext/tk/stubs.c (ruby_open_tcl_dll, ruby_open_tk_dll): make library names by string literal concatenation at compilation time, not by sprintf() at runtime. ------------------------------------------------------------------------ r44572 | nobu | 2014-01-12 17:11:36 +0900 (Sun, 12 Jan 2014) | 1 line ext: use rb_sprintf() and rb_vsprintf() with PRIsVALUE * ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap depending on PRIsVALUE for 1.9. [Backport #9406] * ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback definition for 2.1 or older. [ruby-core:59750] [Backport #9406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk')
-rw-r--r--ext/tk/stubs.c14
-rw-r--r--ext/tk/tcltklib.c7
2 files changed, 9 insertions, 12 deletions
diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c
index 7398a79ae3..6c82c7a7bb 100644
--- a/ext/tk/stubs.c
+++ b/ext/tk/stubs.c
@@ -83,8 +83,8 @@ _nativethread_consistency_check(ip)
# define DL_SYM GetProcAddress
# define TCL_INDEX 4
# define TK_INDEX 3
-# define TCL_NAME "tcl89%s"
-# define TK_NAME "tk89%s"
+# define TCL_NAME "tcl89"
+# define TK_NAME "tk89"
# undef DLEXT
# define DLEXT ".dll"
#elif defined HAVE_DLOPEN
@@ -94,8 +94,8 @@ _nativethread_consistency_check(ip)
# define DL_SYM dlsym
# define TCL_INDEX 8
# define TK_INDEX 7
-# define TCL_NAME "libtcl8.9%s"
-# define TK_NAME "libtk8.9%s"
+# define TCL_NAME "libtcl8.9"
+# define TK_NAME "libtk8.9"
# ifdef __APPLE__
# undef DLEXT
# define DLEXT ".dylib"
@@ -116,7 +116,6 @@ ruby_open_tcl_dll(appname)
void (*p_Tcl_FindExecutable)(const char *);
int n;
char *ruby_tcl_dll = 0;
- char tcl_name[20];
if (tcl_dll) return TCLTK_STUBS_OK;
@@ -127,7 +126,7 @@ ruby_open_tcl_dll(appname)
if (ruby_tcl_dll) {
tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
} else {
- snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
+ char tcl_name[] = TCL_NAME DLEXT;
/* examine from 8.9 to 8.1 */
for (n = '9'; n > '0'; n--) {
tcl_name[TCL_INDEX] = n;
@@ -162,7 +161,6 @@ ruby_open_tk_dll()
{
int n;
char *ruby_tk_dll = 0;
- char tk_name[20];
if (!tcl_dll) {
/* int ret = ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
@@ -176,7 +174,7 @@ ruby_open_tk_dll()
if (ruby_tk_dll) {
tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
} else {
- snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
+ char tk_name[] = TK_NAME DLEXT;
/* examine from 8.9 to 8.1 */
for (n = '9'; n > '0'; n--) {
tk_name[TK_INDEX] = n;
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index a8c98969b4..6e9587e999 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -843,15 +843,14 @@ create_ip_exc(interp, exc, fmt, va_alist)
#endif
{
va_list args;
- char buf[BUFSIZ];
+ VALUE msg;
VALUE einfo;
struct tcltkip *ptr = get_ip(interp);
va_init_list(args,fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
- buf[BUFSIZ - 1] = '\0';
+ msg = rb_vsprintf(fmt, args);
va_end(args);
- einfo = rb_exc_new2(exc, buf);
+ einfo = rb_exc_new3(exc, msg);
rb_ivar_set(einfo, ID_at_interp, interp);
if (ptr) {
Tcl_ResetResult(ptr->ip);