From ed90c969d0b121c04c6e4e5552c6b5e61bd6b36b Mon Sep 17 00:00:00 2001 From: ericm Date: Sat, 8 Jan 2000 02:31:22 +0000 Subject: * generic/tclClock.c: Changed switch in Tcl_ClockObjCmd to use enumerated values instead of constants. (ie, COMMAND_SCAN instead of 3). --- generic/tclClock.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index d46058f..13bf229 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.5 1999/09/21 04:20:39 hobbs Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.6 2000/01/08 02:31:22 ericm Exp $ */ #include "tcl.h" @@ -69,6 +69,9 @@ Tcl_ClockObjCmd (client, interp, objc, objv) static char *switches[] = {"clicks", "format", "scan", "seconds", (char *) NULL}; + enum command { COMMAND_CLICKS, COMMAND_FORMAT, COMMAND_SCAN, + COMMAND_SECONDS + }; static char *formatSwitches[] = {"-format", "-gmt", (char *) NULL}; static char *scanSwitches[] = {"-base", "-gmt", (char *) NULL}; @@ -82,8 +85,8 @@ Tcl_ClockObjCmd (client, interp, objc, objv) != TCL_OK) { return TCL_ERROR; } - switch (index) { - case 0: { /* clicks */ + switch ((enum command) index) { + case COMMAND_CLICKS: { /* clicks */ int forceMilli = 0; if (objc == 3) { @@ -114,7 +117,8 @@ Tcl_ClockObjCmd (client, interp, objc, objv) } return TCL_OK; } - case 1: /* format */ + + case COMMAND_FORMAT: /* format */ if ((objc < 3) || (objc > 7)) { wrongFmtArgs: Tcl_WrongNumArgs(interp, 2, objv, @@ -153,7 +157,8 @@ Tcl_ClockObjCmd (client, interp, objc, objv) } return FormatClock(interp, (unsigned long) clockVal, useGMT, format); - case 2: /* scan */ + + case COMMAND_SCAN: /* scan */ if ((objc < 3) || (objc > 7)) { wrongScanArgs: Tcl_WrongNumArgs(interp, 2, objv, @@ -215,7 +220,8 @@ Tcl_ClockObjCmd (client, interp, objc, objv) Tcl_SetLongObj(resultPtr, (long) clockVal); return TCL_OK; - case 3: /* seconds */ + + case COMMAND_SECONDS: /* seconds */ if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; -- cgit v0.12