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 | 48af16b1e7c2c6005dc3fb8ea9149e22323bb4cc (patch) | |
| tree | 2e14ad1406867a283bb0948904f3b53c11f2b9b2 /generic/tclNamesp.c | |
| parent | 21d2461e24a89372f289691ef600b0d40ee7e9cb (diff) | |
| parent | 588872417ec8b3e46ed3cd42dc4f71b8c28c44b9 (diff) | |
| download | tcl-48af16b1e7c2c6005dc3fb8ea9149e22323bb4cc.zip tcl-48af16b1e7c2c6005dc3fb8ea9149e22323bb4cc.tar.gz tcl-48af16b1e7c2c6005dc3fb8ea9149e22323bb4cc.tar.bz2 | |
Merge to feature branch
Diffstat (limited to 'generic/tclNamesp.c')
| -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; } /* |
