summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-05 14:47:07 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-05 14:47:07 (GMT)
commit3703dbd940d9c1036acd08f1a8fc42d2e542af99 (patch)
tree6cdb4748d375f599c6f943f9dcd5438d330043bd
parent8da19e064b1726cad087cc00da596da9c09704c5 (diff)
parent570a13bc17e30542ae39ec77fe3b3cdc37a1979c (diff)
downloadtcl-3703dbd940d9c1036acd08f1a8fc42d2e542af99.zip
tcl-3703dbd940d9c1036acd08f1a8fc42d2e542af99.tar.gz
tcl-3703dbd940d9c1036acd08f1a8fc42d2e542af99.tar.bz2
Merge trunk
-rw-r--r--generic/tclCmdIL.c3
-rw-r--r--generic/tclLoad.c42
-rw-r--r--tests/load.test4
3 files changed, 23 insertions, 26 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index ec85741..a7a5f43 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1728,9 +1728,6 @@ InfoLoadedCmd(
interpName = NULL;
} else { /* Get pkgs just in specified interp. */
interpName = TclGetString(objv[1]);
- if (!interpName[0]) {
- interpName = NULL;
- }
}
if (objc < 3) { /* Get loaded files in all packages. */
packageName = NULL;
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index aabe3bb..44085d6 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -1051,7 +1051,7 @@ TclGetLoadedPackagesEx(
* otherwise, just return info about this
* interpreter. */
const char *packageName) /* Package name or NULL. If NULL, return info
- * all packages.
+ * for all packages.
*/
{
Tcl_Interp *target;
@@ -1060,26 +1060,6 @@ TclGetLoadedPackagesEx(
Tcl_Obj *resultObj, *pkgDesc[2];
if (targetName == NULL) {
- /*
- * Return information about all of the available packages.
- */
- if (packageName) {
- resultObj = NULL;
- Tcl_MutexLock(&packageMutex);
- for (pkgPtr = firstPackagePtr; pkgPtr != NULL;
- pkgPtr = pkgPtr->nextPtr) {
- if (!strcmp(packageName, pkgPtr->packageName)) {
- resultObj = Tcl_NewStringObj(pkgPtr->fileName, -1);
- break;
- }
- }
- Tcl_MutexUnlock(&packageMutex);
- if (resultObj) {
- Tcl_SetObjResult(interp, resultObj);
- }
- return TCL_OK;
- }
-
resultObj = Tcl_NewObj();
Tcl_MutexLock(&packageMutex);
for (pkgPtr = firstPackagePtr; pkgPtr != NULL;
@@ -1095,6 +1075,26 @@ TclGetLoadedPackagesEx(
}
/*
+ * Return information about all of the available packages.
+ */
+ if (packageName) {
+ resultObj = NULL;
+ Tcl_MutexLock(&packageMutex);
+ for (pkgPtr = firstPackagePtr; pkgPtr != NULL;
+ pkgPtr = pkgPtr->nextPtr) {
+ if (!strcmp(packageName, pkgPtr->packageName)) {
+ resultObj = Tcl_NewStringObj(pkgPtr->fileName, -1);
+ break;
+ }
+ }
+ Tcl_MutexUnlock(&packageMutex);
+ if (resultObj) {
+ Tcl_SetObjResult(interp, resultObj);
+ }
+ return TCL_OK;
+ }
+
+ /*
* Return information about only the packages that are loaded in a given
* interpreter.
*/
diff --git a/tests/load.test b/tests/load.test
index 94451e9..7c4b47f 100644
--- a/tests/load.test
+++ b/tests/load.test
@@ -197,14 +197,14 @@ test load-8.2 {TclGetLoadedPackages procedure} -body {
} -returnCodes error -result {could not find interpreter "gorp"}
test load-8.3a {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] {
lsort -index 1 [info loaded {}]
-} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {*}$alreadyLoaded]]
+} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] {*}$alreadyLoaded]]
test load-8.3b {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] {
lsort -index 1 [info loaded child]
} [lsort -index 1 [list {{} Test} [list [file join $testDir pkgb$ext] Pkgb]]]
test load-8.4 {TclGetLoadedPackages procedure} [list $dll $loaded teststaticpkg] {
load [file join $testDir pkgb$ext] pkgb
list [lsort -index 1 [info loaded {}]] [lsort [info commands pkgb_*]]
-} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}]
+} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}]
interp delete child
test load-9.1 {Tcl_StaticPackage, load already-loaded package into another interp} \