diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2001-10-15 22:15:19 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2001-10-15 22:15:19 (GMT) |
commit | daca0493e175052042d30663c82c160b8f1d0f32 (patch) | |
tree | 0744a4b6189f8db09fd0408fa51a79bd6881232e /generic/tclProc.c | |
parent | d8f2e468454039838648a90be2ff15cc3f4013e0 (diff) | |
download | tcl-daca0493e175052042d30663c82c160b8f1d0f32.zip tcl-daca0493e175052042d30663c82c160b8f1d0f32.tar.gz tcl-daca0493e175052042d30663c82c160b8f1d0f32.tar.bz2 |
generic/tclProc.c: changing a memcmp to strcmp to avoid a memory error
detected by purify (thanks Jeff); modify style to agrre with the style
guide.
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index f2efa09..d7e06e3 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.29 2001/09/27 20:32:35 dgp Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.30 2001/10/15 22:15:19 msofer Exp $ */ #include "tclInt.h" @@ -70,7 +70,7 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv) register Interp *iPtr = (Interp *) interp; Proc *procPtr; char *fullName; - CONST char *procName; + CONST char *procName, *procArgs, *procBody; Namespace *nsPtr, *altNsPtr, *cxtNsPtr; Tcl_Command cmd; Tcl_DString ds; @@ -164,39 +164,38 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv) * compilation of all procs whose argument list is just _args_ */ - { - char *txt; - txt = Tcl_GetString(objv[2]); - - while(*txt == ' ') txt++; - - if ((txt[0] == 'a') && (memcmp(txt, "args", 4) == 0)) { - txt +=4; - while(*txt != '\0') { - if (*txt != ' ') { - goto done; - } - txt++; - } + procArgs = Tcl_GetString(objv[2]); - /* - * The argument list is just "args"; check the body - */ - - txt = Tcl_GetString(objv[3]); - while(*txt != '\0') { - if (!isspace(*txt)) { - goto done; - } - txt++; - } + while(*procArgs == ' ') { + procArgs++; + } - /* - * The body is just spaces: link the compileProc - */ - - ((Command *) cmd)->compileProc = TclCompileNoOp; - } + if ((procArgs[0] == 'a') && (strcmp(procArgs, "args") == 0)) { + procArgs +=4; + while(*procArgs != '\0') { + if (*procArgs != ' ') { + goto done; + } + procArgs++; + } + + /* + * The argument list is just "args"; check the body + */ + + procBody = Tcl_GetString(objv[3]); + while(*procBody != '\0') { + if (!isspace(*procBody)) { + goto done; + } + procBody++; + } + + /* + * The body is just spaces: link the compileProc + */ + + ((Command *) cmd)->compileProc = TclCompileNoOp; } done: |