diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-04-12 11:08:18 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-04-12 11:08:18 (GMT) |
commit | 98fc2e08c445e88c982282eba4b2f7da09a583e9 (patch) | |
tree | f4cf227e14cdc2994b8c031ecf77513425c1b187 /generic | |
parent | 6379f60ed8aca0d3ce1aa00314d5249bf6da6f86 (diff) | |
download | tcl-98fc2e08c445e88c982282eba4b2f7da09a583e9.zip tcl-98fc2e08c445e88c982282eba4b2f7da09a583e9.tar.gz tcl-98fc2e08c445e88c982282eba4b2f7da09a583e9.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().
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclDecls.h | 10 | ||||
-rw-r--r-- | generic/tclPkg.c | 11 |
2 files changed, 17 insertions, 4 deletions
diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 618536d..a94cb0e 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4516,6 +4516,16 @@ extern TclStubs *tclStubsPtr; #undef TclUnusedStubEntry +#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 940d011..6ab1b33 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -119,6 +119,7 @@ static CONST char * PkgRequireCore(Tcl_Interp *interp, CONST char *name, *---------------------------------------------------------------------- */ +#undef Tcl_PkgProvide int Tcl_PkgProvide(interp, name, version) Tcl_Interp *interp; /* Interpreter in which package is now @@ -223,6 +224,7 @@ Tcl_PkgRequireProc(interp,name,reqc,reqv,clientDataPtr) } #endif +#undef Tcl_PkgRequire CONST char * Tcl_PkgRequire(interp, name, version, exact) Tcl_Interp *interp; /* Interpreter in which package is now @@ -827,6 +829,7 @@ PkgRequireCore( *---------------------------------------------------------------------- */ +#undef Tcl_PkgPresent CONST char * Tcl_PkgPresent(interp, name, version, exact) Tcl_Interp *interp; /* Interpreter in which package is now @@ -1127,7 +1130,7 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) } } #endif - Tcl_PkgPresent(interp, name, version, exact); + Tcl_PkgPresentEx(interp, name, version, exact, NULL); return TCL_ERROR; break; } @@ -1155,7 +1158,7 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) #endif return TCL_ERROR; } - return Tcl_PkgProvide(interp, argv2, argv3); + return Tcl_PkgProvideEx(interp, argv2, argv3, NULL); } case PKG_REQUIRE: { require: @@ -1187,9 +1190,9 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) } if (exact) { argv3 = Tcl_GetString(objv[3]); - version = Tcl_PkgRequire(interp, argv3, version, exact); + version = Tcl_PkgRequireEx(interp, argv3, version, exact, NULL); } else { - version = Tcl_PkgRequire(interp, argv2, version, exact); + version = Tcl_PkgRequireEx(interp, argv2, version, exact, NULL); } if (version == NULL) { return TCL_ERROR; |