summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-09-24 14:43:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-09-24 14:43:22 (GMT)
commit6cb35bd89c9c92869e597871a2733ebdfa75e0d7 (patch)
tree920ca7738a37d0b3fd7fa2404a3c79d51ee666d3
parent7e7a246d3ed9305597efc22b09273a9faafc5c68 (diff)
downloadtcl-6cb35bd89c9c92869e597871a2733ebdfa75e0d7.zip
tcl-6cb35bd89c9c92869e597871a2733ebdfa75e0d7.tar.gz
tcl-6cb35bd89c9c92869e597871a2733ebdfa75e0d7.tar.bz2
Minor simplification and correct TCL_NORETURN decorationrfe_854941
-rw-r--r--generic/tclStubLibDl.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/generic/tclStubLibDl.c b/generic/tclStubLibDl.c
index bae2e64..2e09659 100644
--- a/generic/tclStubLibDl.c
+++ b/generic/tclStubLibDl.c
@@ -46,7 +46,7 @@ Tcl_InitSubsystems(
const char *(*initSubsystems)(TCL_NORETURN1 Tcl_PanicProc *);
int a,b,c,d;
- if (!info.version[0]) {
+ if (!info.stubs) {
void *handle = dlopen(TCL_DLL_FILE, RTLD_NOW|RTLD_LOCAL);
if (!handle) {
handle = dlopen(TCL_PREV_DLL_FILE, RTLD_NOW|RTLD_LOCAL);
@@ -67,12 +67,11 @@ Tcl_InitSubsystems(
if (initSubsystems) {
/* If the core has TIP #414, use it. */
const char *version = initSubsystems(panicProc);
+ strcpy(info.version, version);
info.stubs = ((const TclStubs **)version)[-1];
- strcpy(info.version+1, version+1);
- info.version[0] = version[0];
} else {
const TclStubs *stubs;
- const char *(*setPanicProc)(Tcl_PanicProc *);
+ const char *(*setPanicProc)(TCL_NORETURN1 Tcl_PanicProc *);
Tcl_Interp *interp, *(*createInterp)(void);
setPanicProc = dlsym(handle, "Tcl_SetPanicProc");
@@ -88,14 +87,8 @@ Tcl_InitSubsystems(
stubs = ((Interp *) interp)->stubTable;
stubs->tcl_DeleteInterp(interp);
stubs->tcl_GetVersion(&a, &b, &c, &d);
+ sprintf(info.version, "%d.%d%c%d", a, b, "ab."[d], c);
info.stubs = stubs;
- if (a>9) {
- sprintf(info.version+1, "%d.%d%c%d", a%10, b, "ab."[d], c);
- info.version[0] = '0' + (a/10);
- } else {
- sprintf(info.version+1, ".%d%c%d", b, "ab."[d], c);
- info.version[0] = '0' + a;
- }
}
}
return info.version;