View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] bug in XOTcl_DeleteCommandFromToken ?

From: Jeff Hobbs <jeffh_at_ActiveState.com>
Date: Tue, 30 Nov 2004 11:57:22 -0800

I found this oddity in XOTcl_DeleteCommandFromToken:

   XOTclCallStackContent *csc = cs->top;
 
   for (; csc > cs->content; csc--) {
- if (csc->cmdPtr == cmd)
- csc->cmdPtr = NULL;
- break;
+ if (csc->cmdPtr == cmd) {
+ csc->cmdPtr = NULL;
+ break;
+ }
   }
   return Tcl_DeleteCommandFromToken(in, cmd);
 }

Is my fix correct, or is there some magic reason why you
would want to break after the first 'if' check no matter
what?

BTW - any conditionals without { } is BAD CODE, for exactly
the above reason.

  Jeff Hobbs, The Tcl Guy
  http://www.ActiveState.com/, a division of Sophos