summaryrefslogtreecommitdiff
path: root/ext/tk
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-02 01:59:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-02 01:59:13 +0000
commit59cfce150b970be1d66ad577ee4d26d9baa932a8 (patch)
treef63fdea310946a4fdcf3c3be27a412ea77fd5b32 /ext/tk
parent9fc370197a53437e6a00f6f9de2b16821eee445d (diff)
tcltklib.c: compile info
* ext/tk/tcltklib.c (tcltklib_compile_info): build compile info statically. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk')
-rw-r--r--ext/tk/tcltklib.c59
1 files changed, 20 insertions, 39 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 7b547b79d1..8143967015 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -9998,62 +9998,43 @@ lib_get_reltype_name(self)
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;
}