diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-04-12 11:22:43 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-04-12 11:22:43 (GMT) |
commit | 05aa6581cccb3435b6e1e24b98d0f6f5a9df56eb (patch) | |
tree | 17e79aba97d2060fe04dd26148f10bb53a7c857e | |
parent | 160878c61416b18aa1689427fb56ef63863948d3 (diff) | |
parent | 98fc2e08c445e88c982282eba4b2f7da09a583e9 (diff) | |
download | tcl-05aa6581cccb3435b6e1e24b98d0f6f5a9df56eb.zip tcl-05aa6581cccb3435b6e1e24b98d0f6f5a9df56eb.tar.gz tcl-05aa6581cccb3435b6e1e24b98d0f6f5a9df56eb.tar.bz2 |
Implement Tcl_Pkg* functions as macro's around Tcl_Pkg*Ex. This saves stack space, is (marginally) faster, while still being fully up/down compatible. It makes pkgb.so loadable in "novem" without the need to change the Tcl_PkgProvide() call to Tcl_PkgProvideEx().
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclDecls.h | 10 | ||||
-rw-r--r-- | generic/tclPkg.c | 7 | ||||
-rw-r--r-- | unix/dltest/pkgb.c | 4 |
4 files changed, 22 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2013-04-12 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclDecls.h: Implement Tcl_Pkg* functions as + (faster/stack-saving) macros around Tcl_Pkg*Ex functions. + 2013-04-08 Don Porter <dgp@users.sourceforge.net> * generic/regc_color.c: [Bug 3610026] Stop crash when the number of diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 456337a..2196f46 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -6547,6 +6547,16 @@ extern TclStubs *tclStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT +#undef Tcl_PkgPresent +#define Tcl_PkgPresent(interp, name, version, exact) \ + Tcl_PkgPresentEx(interp, name, version, exact, NULL) +#undef Tcl_PkgProvide +#define Tcl_PkgProvide(interp, name, version) \ + Tcl_PkgProvideEx(interp, name, version, NULL) +#undef Tcl_PkgRequire +#define Tcl_PkgRequire(interp, name, version, exact) \ + Tcl_PkgRequireEx(interp, name, version, exact, NULL) + /* * Deprecated Tcl procedures: */ diff --git a/generic/tclPkg.c b/generic/tclPkg.c index b3396e6..52f33c3 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -106,6 +106,7 @@ static const char * PkgRequireCore(Tcl_Interp *interp, const char *name, *---------------------------------------------------------------------- */ +#undef Tcl_PkgProvide int Tcl_PkgProvide( Tcl_Interp *interp, /* Interpreter in which package is now @@ -186,6 +187,7 @@ Tcl_PkgProvideEx( *---------------------------------------------------------------------- */ +#undef Tcl_PkgRequire const char * Tcl_PkgRequire( Tcl_Interp *interp, /* Interpreter in which package is now @@ -655,6 +657,7 @@ PkgRequireCore( *---------------------------------------------------------------------- */ +#undef Tcl_PkgPresent const char * Tcl_PkgPresent( Tcl_Interp *interp, /* Interpreter in which package is now @@ -921,7 +924,7 @@ Tcl_PackageObjCmd( version = TclGetString(objv[3]); } } - Tcl_PkgPresent(interp, name, version, exact); + Tcl_PkgPresentEx(interp, name, version, exact, NULL); return TCL_ERROR; break; } @@ -945,7 +948,7 @@ Tcl_PackageObjCmd( if (CheckVersionAndConvert(interp, argv3, NULL, NULL) != TCL_OK) { return TCL_ERROR; } - return Tcl_PkgProvide(interp, argv2, argv3); + return Tcl_PkgProvideEx(interp, argv2, argv3, NULL); case PKG_REQUIRE: require: if (objc < 3) { diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c index 039ad91..4d8cdab 100644 --- a/unix/dltest/pkgb.c +++ b/unix/dltest/pkgb.c @@ -124,7 +124,7 @@ Pkgb_Init( } Tcl_ResetResult(interp); } - code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL); + code = Tcl_PkgProvide(interp, "Pkgb", "2.3"); if (code != TCL_OK) { return code; } @@ -165,7 +165,7 @@ Pkgb_SafeInit( } Tcl_ResetResult(interp); } - code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL); + code = Tcl_PkgProvide(interp, "Pkgb", "2.3"); if (code != TCL_OK) { return code; } |