Diff
Not logged in

Differences From Artifact [0a5c6ba9bc]:

To Artifact [f749e79b51]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* 
 * tclTrace.c --
 *
 *	This file contains code to handle most trace management.
 *
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-2000 Scriptics Corporation.
 * Copyright (c) 2002 ActiveState Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclTrace.c,v 1.21 2004/11/15 21:47:23 dgp Exp $
 */

#include "tclInt.h"

/*
 * Structure used to hold information about variable traces:
 */













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* 
 * tclTrace.c --
 *
 *	This file contains code to handle most trace management.
 *
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-2000 Scriptics Corporation.
 * Copyright (c) 2002 ActiveState Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclTrace.c,v 1.21.4.1 2005/04/11 09:11:47 msofer Exp $
 */

#include "tclInt.h"

/*
 * Structure used to hold information about variable traces:
 */
2735
2736
2737
2738
2739
2740
2741

2742
2743






2744
2745
2746
2747
2748
2749
2750
    Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);

    /*
     * If this is the last trace on the variable, and the variable is
     * unset and unused, then free up the variable.
     */


    if (TclIsVarUndefined(varPtr)) {
	TclCleanupVar(varPtr, (Var *) NULL);






    }
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_VarTraceInfo --







>
|
|
>
>
>
>
>
>







2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
    Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);

    /*
     * If this is the last trace on the variable, and the variable is
     * unset and unused, then free up the variable.
     */

    if (!varPtr->tracePtr) {
	if (TclIsVarUndefined(varPtr)) {
	    TclCleanupVar(varPtr, (Var *) NULL);
	} else if (TclIsVarScalar(varPtr)) {
	    if (!((varPtr->flags & VAR_IN_HASHTABLE)
			&& (varPtr->id.hPtr == NULL))) {
		varPtr->flags |= (VAR_DIRECT_READABLE|VAR_DIRECT_WRITABLE);
	    }
	}
    }
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_VarTraceInfo --
2968
2969
2970
2971
2972
2973
2974

2975
2976
#endif
    tracePtr = (VarTrace *) ckalloc(sizeof(VarTrace));
    tracePtr->traceProc		= proc;
    tracePtr->clientData	= clientData;
    tracePtr->flags		= flags & flagMask;
    tracePtr->nextPtr		= varPtr->tracePtr;
    varPtr->tracePtr		= tracePtr;

    return TCL_OK;
}







>


2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
#endif
    tracePtr = (VarTrace *) ckalloc(sizeof(VarTrace));
    tracePtr->traceProc		= proc;
    tracePtr->clientData	= clientData;
    tracePtr->flags		= flags & flagMask;
    tracePtr->nextPtr		= varPtr->tracePtr;
    varPtr->tracePtr		= tracePtr;
    varPtr->flags &= ~(VAR_DIRECT_READABLE|VAR_DIRECT_WRITABLE);
    return TCL_OK;
}