summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 09:13:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 09:13:31 (GMT)
commitf87e7cdade0bf88329c0502b62047b06a645b264 (patch)
treedb3d92d7f56253982dc962f282e591a5cdb1d393 /unix
parent296aebbd6ee092a25741684fa37ee31ef5a3e222 (diff)
parentcd8d5b5a18221b00c35aa76c901a50d7fa45bef8 (diff)
downloadtcl-f87e7cdade0bf88329c0502b62047b06a645b264.zip
tcl-f87e7cdade0bf88329c0502b62047b06a645b264.tar.gz
tcl-f87e7cdade0bf88329c0502b62047b06a645b264.tar.bz2
Inline compat Tcl_GetDefaultEncodingDir.
Eliminate unnecessary static HasStubSupport() and isDigit() functions, just do the same inline.
Diffstat (limited to 'unix')
-rw-r--r--unix/dltest/pkgb.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index 9884a64..40f1fdd 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -15,14 +15,6 @@
#include "tcl.h"
/*
- * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
- * Pkgb_Init declaration is in the source file itself, which is only
- * accessed when we are building a library.
- */
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLEXPORT
-
-/*
* Prototypes for procedures defined later in this file:
*/
@@ -98,22 +90,6 @@ Pkgb_UnsafeObjCmd(
return Tcl_EvalEx(interp, "list unsafe command invoked", -1, TCL_EVAL_GLOBAL);
}
-#if (TCL_MAJOR_VERSION > 8)
-const char *Tcl_GetDefaultEncodingDir(void)
-{
- int numDirs;
- Tcl_Obj *first, *searchPath = Tcl_GetEncodingSearchPath();
-
- Tcl_ListObjLength(NULL, searchPath, &numDirs);
- if (numDirs == 0) {
- return NULL;
- }
- Tcl_ListObjIndex(NULL, searchPath, 0, &first);
-
- return Tcl_GetString(first);
-}
-#endif
-
static int
Pkgb_DemoObjCmd(
ClientData dummy, /* Not used. */
@@ -121,7 +97,16 @@ Pkgb_DemoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
+#if (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 4)
+ Tcl_Obj *first;
+
+ if (Tcl_ListObjIndex(NULL, Tcl_GetEncodingSearchPath(), 0, &first)
+ == TCL_OK) {
+ Tcl_SetObjResult(interp, first);
+ }
+#else
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetDefaultEncodingDir(), -1));
+#endif
return TCL_OK;
}
@@ -142,14 +127,14 @@ Pkgb_DemoObjCmd(
*----------------------------------------------------------------------
*/
-EXTERN int
+DLLEXPORT int
Pkgb_Init(
Tcl_Interp *interp) /* Interpreter in which the package is to be
* made available. */
{
int code;
- if (Tcl_InitStubs(interp, "8.5-9.1", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) {
return TCL_ERROR;
}
code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL);
@@ -179,14 +164,14 @@ Pkgb_Init(
*----------------------------------------------------------------------
*/
-EXTERN int
+DLLEXPORT int
Pkgb_SafeInit(
Tcl_Interp *interp) /* Interpreter in which the package is to be
* made available. */
{
int code;
- if (Tcl_InitStubs(interp, "8.5-9.1", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) {
return TCL_ERROR;
}
code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL);