Check-in [5202be705d]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: * generic/tclCmdIl.c (Tcl_LreverseObjCmd): * tests/cmdIL.test (cmdIL-7.7): fix crash on reversing an empty list [Bug 1876793].
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5202be705d52fe76d17c63054ea98d89504fd70f
User & Date: msofer 2008-01-22 11:38:31.000
Context
2008-01-22
20:52
* generic/tclTimer.c (AfterProc): Replace Tcl_EvalEx() with Tcl_EvalObjEx() to... check-in: bfc294566c user: dgp tags: trunk
11:38
* generic/tclCmdIl.c (Tcl_LreverseObjCmd): * tests/cmdIL.test (cmdIL-7.7): fix crash on reversing ... check-in: 5202be705d user: msofer tags: trunk
2008-01-20
21:19
* unix/README: minor typo fixes [Bug 1853072] check-in: db1ea1047e user: hobbs tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.






1
2
3
4
5
6
7






2008-01-20  Jeff Hobbs  <jeffh@ActiveState.com>

	* unix/README: minor typo fixes [Bug 1853072]

	* generic/tclIO.c (TclGetsObjBinary): operate on topmost channel.
	[Bug 1869405] (Ficicchia)

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2008-01-22  Miguel Sofer  <msofer@users.sf.net>

	* generic/tclCmdIl.c (Tcl_LreverseObjCmd): 
	* tests/cmdIL.test (cmdIL-7.7): fix crash on reversing an empty
	list [Bug 1876793].

2008-01-20  Jeff Hobbs  <jeffh@ActiveState.com>

	* unix/README: minor typo fixes [Bug 1853072]

	* generic/tclIO.c (TclGetsObjBinary): operate on topmost channel.
	[Bug 1869405] (Ficicchia)

Changes to generic/tclCmdIL.c.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
 * Copyright (c) 2005 Donal K. Fellows.
 *
 * 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.135 2007/12/26 19:26:08 msofer Exp $
 */

#include "tclInt.h"
#include "tclRegexp.h"

/*
 * During execution of the "lsort" command, structures of the following type







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
 * Copyright (c) 2005 Donal K. Fellows.
 *
 * 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.136 2008/01/22 11:38:33 msofer Exp $
 */

#include "tclInt.h"
#include "tclRegexp.h"

/*
 * During execution of the "lsort" command, structures of the following type
2604
2605
2606
2607
2608
2609
2610









2611
2612
2613
2614
2615
2616
2617
    if (objc != 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "list");
	return TCL_ERROR;
    }
    if (TclListObjGetElements(interp, objv[1], &elemc, &elemv) != TCL_OK) {
	return TCL_ERROR;
    }










    if (Tcl_IsShared(objv[1])) {
	Tcl_Obj *resultObj, **dataArray;
	List *listPtr;

    makeNewReversedList:
	resultObj = Tcl_NewListObj(elemc, NULL);







>
>
>
>
>
>
>
>
>







2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
    if (objc != 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "list");
	return TCL_ERROR;
    }
    if (TclListObjGetElements(interp, objv[1], &elemc, &elemv) != TCL_OK) {
	return TCL_ERROR;
    }

    /*
     * If the list is empty, just return it [Bug 1876793]
     */

    if (!elemc) {
	Tcl_SetObjResult(interp, objv[1]);
	return TCL_OK;
    }

    if (Tcl_IsShared(objv[1])) {
	Tcl_Obj *resultObj, **dataArray;
	List *listPtr;

    makeNewReversedList:
	resultObj = Tcl_NewListObj(elemc, NULL);
Changes to tests/cmdIL.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This file contains a collection of tests for the procedures in the
# file tclCmdIL.c.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: cmdIL.test,v 1.36 2007/12/23 17:52:34 msofer Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest 2
    namespace import -force ::tcltest::*
}

# Used for constraining memory leak tests










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This file contains a collection of tests for the procedures in the
# file tclCmdIL.c.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: cmdIL.test,v 1.37 2008/01/22 11:38:34 msofer Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest 2
    namespace import -force ::tcltest::*
}

# Used for constraining memory leak tests
746
747
748
749
750
751
752



753
754
755
756
757
758
759
} {f e {c d} b a}
test cmdIL-7.5 {lreverse command - unshared object} {
    lreverse [list a b {c d} e f]
} {f e {c d} b a}
test cmdIL-7.6 {lreverse command - unshared object [Bug 1672585]} {
    lreverse [set x {1 2 3}][unset x]
} {3 2 1}




testConstraint testobj [llength [info commands testobj]]
test cmdIL-7.7 {lreverse command - shared intrep [Bug 1675044]} -setup {
    teststringobj set 1 {1 2 3}
    testobj convert 1 list
    testobj duplicate 1 2
    variable x [teststringobj get 1]







>
>
>







746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
} {f e {c d} b a}
test cmdIL-7.5 {lreverse command - unshared object} {
    lreverse [list a b {c d} e f]
} {f e {c d} b a}
test cmdIL-7.6 {lreverse command - unshared object [Bug 1672585]} {
    lreverse [set x {1 2 3}][unset x]
} {3 2 1}
test cmdIL-7.7 {lreverse command - empty object [Bug 1876793]} {
    lreverse [list]
} {}

testConstraint testobj [llength [info commands testobj]]
test cmdIL-7.7 {lreverse command - shared intrep [Bug 1675044]} -setup {
    teststringobj set 1 {1 2 3}
    testobj convert 1 list
    testobj duplicate 1 2
    variable x [teststringobj get 1]