diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-09 19:42:51 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-09 19:42:51 (GMT) |
commit | 62c99a1fde06fc47b9a61460f1ab2fdfc7ede16f (patch) | |
tree | 2e14ad1406867a283bb0948904f3b53c11f2b9b2 /generic | |
parent | 1111254200cc2b8bc8aa2d899f43d56884f1f1cb (diff) | |
parent | 66c00a872668c60fedb51c5b242df305c7557826 (diff) | |
download | tcl-62c99a1fde06fc47b9a61460f1ab2fdfc7ede16f.zip tcl-62c99a1fde06fc47b9a61460f1ab2fdfc7ede16f.tar.gz tcl-62c99a1fde06fc47b9a61460f1ab2fdfc7ede16f.tar.bz2 |
Merge to feature branch
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclNamesp.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 69411c2..7f86c38 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -3001,7 +3001,7 @@ NamespaceCodeCmd( { Namespace *currNsPtr; Tcl_Obj *listPtr, *objPtr; - register const char *arg, *p; + register const char *arg; int length; if (objc != 2) { @@ -3011,21 +3011,17 @@ NamespaceCodeCmd( /* * If "arg" is already a scoped value, then return it directly. + * Take care to only check for scoping in precisely the style that + * [::namespace code] generates it. Anything more forgiving can have + * the effect of failing in namespaces that contain their own custom + " "namespace" command. [Bug 3202171]. */ arg = TclGetStringFromObj(objv[1], &length); - while (*arg == ':') { - arg++; - length--; - } - if (*arg=='n' && length>17 && strncmp(arg, "namespace", 9)==0) { - for (p=arg+9 ; isspace(UCHAR(*p)) ; p++) { - /* empty body: skip over whitespace */ - } - if (*p=='i' && (p+7 <= arg+length) && strncmp(p, "inscope", 7)==0) { - Tcl_SetObjResult(interp, objv[1]); - return TCL_OK; - } + if (*arg==':' && length > 20 + && strncmp(arg, "::namespace inscope ", 20) == 0) { + Tcl_SetObjResult(interp, objv[1]); + return TCL_OK; } /* |