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

ruby-changes:43722

From: nobu <ko1@a...>
Date: Tue, 2 Aug 2016 10:59:18 +0900 (JST)
Subject: [ruby-changes:43722] nobu:r55795 (trunk): tcltklib.c: compile info

nobu	2016-08-02 10:59:13 +0900 (Tue, 02 Aug 2016)

  New Revision: 55795

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55795

  Log:
    tcltklib.c: compile info
    
    * ext/tk/tcltklib.c (tcltklib_compile_info): build compile info
      statically.

  Modified files:
    trunk/ext/tk/tcltklib.c
Index: ext/tk/tcltklib.c
===================================================================
--- ext/tk/tcltklib.c	(revision 55794)
+++ ext/tk/tcltklib.c	(revision 55795)
@@ -9998,62 +9998,43 @@ lib_get_reltype_name(self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L9998
 static VALUE
 tcltklib_compile_info(void)
 {
-    volatile VALUE ret;
-    size_t size;
-    static CONST char form[]
-      = "tcltklib %s :: Ruby%s (%s) %s pthread :: Tcl%s(%s)/Tk%s(%s) %s";
-    char *info;
-
-    size = strlen(form)
-        + strlen(TCLTKLIB_RELEASE_DATE)
-        + strlen(RUBY_VERSION)
-        + strlen(RUBY_RELEASE_DATE)
-        + strlen("without")
-        + strlen(TCL_PATCH_LEVEL)
-        + strlen("without stub")
-        + strlen(TK_PATCH_LEVEL)
-        + strlen("without stub")
-        + strlen("unknown tcl_threads");
-
-    info = ALLOC_N(char, size);
-    /* info = ckalloc(sizeof(char) * size); */ /* SEGV */
-
-    sprintf(info, form,
-            TCLTKLIB_RELEASE_DATE,
-            RUBY_VERSION, RUBY_RELEASE_DATE,
+    VALUE ret;
+    static const char info[] =
+	"tcltklib " TCLTKLIB_RELEASE_DATE " "
+	":: Ruby" RUBY_VERSION" ("RUBY_RELEASE_DATE") "
 #ifdef HAVE_NATIVETHREAD
-            "with",
+	"with"
 #else
-            "without",
+	"without"
 #endif
-            TCL_PATCH_LEVEL,
+	" pthread "
+	":: Tcl" TCL_PATCH_LEVEL "("
 #ifdef USE_TCL_STUBS
-            "with stub",
+	"with"
 #else
-            "without stub",
+	"without"
 #endif
-            TK_PATCH_LEVEL,
+	" stub)"
+	"/"
+	"Tk" TK_PATCH_LEVEL "("
 #ifdef USE_TK_STUBS
-            "with stub",
+	"with"
 #else
-            "without stub",
+	"without"
 #endif
+	" stub) "
 #ifdef WITH_TCL_ENABLE_THREAD
 # if WITH_TCL_ENABLE_THREAD
-            "with tcl_threads"
+	"with"
 # else
-            "without tcl_threads"
+	"without"
 # endif
 #else
-            "unknown tcl_threads"
+	"unknown"
 #endif
-        );
-
+	" tcl_threads";
     ret = rb_obj_freeze(rb_str_new2(info));
 
-    xfree(info);
-    /* ckfree(info); */
-
     return ret;
 }
 

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

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