summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdIL.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-09-26 21:05:54 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-09-26 21:05:54 (GMT)
commit11a39b96c6ee19beca3ef9583139c4a8377bcaa9 (patch)
treeac5ee07fdd2aa2dae014ee703f1ad89e20eb22d8 /generic/tclCmdIL.c
parent03fe58895ff5d2fff94410b80ecf3fd7907b7948 (diff)
downloadtcl-11a39b96c6ee19beca3ef9583139c4a8377bcaa9.zip
tcl-11a39b96c6ee19beca3ef9583139c4a8377bcaa9.tar.gz
tcl-11a39b96c6ee19beca3ef9583139c4a8377bcaa9.tar.bz2
TIP #323 IMPLEMENTATION (partial)
* doc/lrepeat.n: Revise [lrepeat] to accept both zero * generic/tclCmdIL.c: repetitions and zero elements to be repeated. * tests/lrepeat.test:
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r--generic/tclCmdIL.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index e1e15e1..99a6cb5 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdIL.c,v 1.152 2008/09/26 19:12:42 dgp Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.153 2008/09/26 21:05:57 dgp Exp $
*/
#include "tclInt.h"
@@ -2443,25 +2443,25 @@ Tcl_LrepeatObjCmd(
register Tcl_Obj *const objv[])
/* The argument objects. */
{
- int elementCount, i, result;
+ int elementCount, i;
Tcl_Obj *listPtr, **dataArray;
List *listRepPtr;
/*
* Check arguments for legality:
- * lrepeat posInt value ?value ...?
+ * lrepeat count ?value ...?
*/
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "positiveCount value ?value ...?");
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "count ?value ...?");
return TCL_ERROR;
}
- result = TclGetIntFromObj(interp, objv[1], &elementCount);
- if (result == TCL_ERROR) {
+ if (TCL_OK != TclGetIntFromObj(interp, objv[1], &elementCount)) {
return TCL_ERROR;
}
- if (elementCount < 1) {
- Tcl_AppendResult(interp, "must have a count of at least 1", NULL);
+ if (elementCount < 0) {
+ Tcl_SetObjResult(interp, Tcl_Format(NULL,
+ "bad count \"%d\": must be integer >= 0", 1, objv+1));
return TCL_ERROR;
}