[前][次][番号順一覧][スレッド一覧]

ruby-changes:32492

From: nobu <ko1@a...>
Date: Sun, 12 Jan 2014 17:11:40 +0900 (JST)
Subject: [ruby-changes:32492] nobu:r44571 (trunk): stubs.c: library name strings

nobu	2014-01-12 17:11:34 +0900 (Sun, 12 Jan 2014)

  New Revision: 44571

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44571

  Log:
    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.

  Modified files:
    trunk/ext/tk/stubs.c
Index: ext/tk/stubs.c
===================================================================
--- ext/tk/stubs.c	(revision 44570)
+++ ext/tk/stubs.c	(revision 44571)
@@ -83,8 +83,8 @@ _nativethread_consistency_check(ip) https://github.com/ruby/ruby/blob/trunk/ext/tk/stubs.c#L83
 # 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) https://github.com/ruby/ruby/blob/trunk/ext/tk/stubs.c#L94
 # 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) https://github.com/ruby/ruby/blob/trunk/ext/tk/stubs.c#L116
     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) https://github.com/ruby/ruby/blob/trunk/ext/tk/stubs.c#L126
     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() https://github.com/ruby/ruby/blob/trunk/ext/tk/stubs.c#L161
 {
     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() https://github.com/ruby/ruby/blob/trunk/ext/tk/stubs.c#L174
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]