summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2005-04-03 00:20:05 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2005-04-03 00:20:05 (GMT)
commitf766511ac090d536adfe97fae9f5a62df10ed757 (patch)
tree01727e1764e4d1ef5e154a0856aac84569d8d010 /generic
parent95b50e96cfeca13080aa95e5a4cd378cbea25955 (diff)
downloadtcl-f766511ac090d536adfe97fae9f5a62df10ed757.zip
tcl-f766511ac090d536adfe97fae9f5a62df10ed757.tar.gz
tcl-f766511ac090d536adfe97fae9f5a62df10ed757.tar.bz2
* generic/tclVar.c: converted a few function calls to macros.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclVar.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index dc8162e..7944ea6 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.102 2005/04/02 02:09:01 msofer Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.103 2005/04/03 00:20:08 msofer Exp $
*/
#include "tclInt.h"
@@ -504,7 +504,7 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2,
* array name.
*/
- part1Ptr = Tcl_NewStringObj(part1, len1);
+ TclNewStringObj(part1Ptr, part1, len1);
Tcl_IncrRefCount(part1Ptr);
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) part1Ptr;
@@ -1619,7 +1619,7 @@ TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2, newValuePtr, flags)
oldValuePtr = varPtr->value.objPtr;
if (flags & (TCL_APPEND_VALUE|TCL_LIST_ELEMENT)) {
if (TclIsVarUndefined(varPtr) && (oldValuePtr != NULL)) {
- Tcl_DecrRefCount(oldValuePtr); /* discard old value */
+ TclDecrRefCount(oldValuePtr); /* discard old value */
varPtr->value.objPtr = NULL;
oldValuePtr = NULL;
}
@@ -1630,7 +1630,7 @@ TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2, newValuePtr, flags)
Tcl_IncrRefCount(oldValuePtr); /* since var is referenced */
} else if (Tcl_IsShared(oldValuePtr)) {
varPtr->value.objPtr = Tcl_DuplicateObj(oldValuePtr);
- Tcl_DecrRefCount(oldValuePtr);
+ TclDecrRefCount(oldValuePtr);
oldValuePtr = varPtr->value.objPtr;
Tcl_IncrRefCount(oldValuePtr); /* since var is referenced */
}
@@ -1849,10 +1849,10 @@ TclPtrIncrVar(interp, varPtr, arrayPtr, part1, part2, incrAmount, flags)
if (varValuePtr->typePtr == &tclWideIntType) {
Tcl_WideInt wide;
TclGetWide(wide,varValuePtr);
- Tcl_SetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
+ TclSetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
} else if (varValuePtr->typePtr == &tclIntType) {
i = varValuePtr->internalRep.longValue;
- Tcl_SetIntObj(varValuePtr, i + incrAmount);
+ TclSetIntObj(varValuePtr, i + incrAmount);
} else {
/*
* Not an integer or wide internal-rep...
@@ -1860,15 +1860,15 @@ TclPtrIncrVar(interp, varPtr, arrayPtr, part1, part2, incrAmount, flags)
Tcl_WideInt wide;
if (Tcl_GetWideIntFromObj(interp, varValuePtr, &wide) != TCL_OK) {
if (createdNewObj) {
- Tcl_DecrRefCount(varValuePtr); /* free unneeded copy */
+ TclDecrRefCount(varValuePtr); /* free unneeded copy */
}
return NULL;
}
if (wide <= Tcl_LongAsWide(LONG_MAX)
&& wide >= Tcl_LongAsWide(LONG_MIN)) {
- Tcl_SetLongObj(varValuePtr, Tcl_WideAsLong(wide) + incrAmount);
+ TclSetLongObj(varValuePtr, Tcl_WideAsLong(wide) + incrAmount);
} else {
- Tcl_SetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
+ TclSetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
}
}
@@ -2012,10 +2012,10 @@ TclPtrIncrWideVar(interp, varPtr, arrayPtr, part1, part2, incrAmount, flags)
}
if (varValuePtr->typePtr == &tclWideIntType) {
TclGetWide(wide, varValuePtr);
- Tcl_SetWideIntObj(varValuePtr, wide + incrAmount);
+ TclSetWideIntObj(varValuePtr, wide + incrAmount);
} else if (varValuePtr->typePtr == &tclIntType) {
long i = varValuePtr->internalRep.longValue;
- Tcl_SetWideIntObj(varValuePtr, Tcl_LongAsWide(i) + incrAmount);
+ TclSetWideIntObj(varValuePtr, Tcl_LongAsWide(i) + incrAmount);
} else {
/*
* Not an integer or wide internal-rep...
@@ -2026,7 +2026,7 @@ TclPtrIncrWideVar(interp, varPtr, arrayPtr, part1, part2, incrAmount, flags)
}
return NULL;
}
- Tcl_SetWideIntObj(varValuePtr, wide + incrAmount);
+ TclSetWideIntObj(varValuePtr, wide + incrAmount);
}
/*
@@ -2485,7 +2485,7 @@ Tcl_LappendObjCmd(dummy, interp, objc, objv)
* initial value.
*/
- varValuePtr = Tcl_NewObj();
+ TclNewObj(varValuePtr);
newValuePtr = Tcl_ObjSetVar2(interp, objv[1], NULL, varValuePtr,
TCL_LEAVE_ERR_MSG);
if (newValuePtr == NULL) {
@@ -2541,7 +2541,7 @@ Tcl_LappendObjCmd(dummy, interp, objc, objv)
*/
createVar = (TclIsVarUndefined(varPtr));
- varValuePtr = Tcl_NewObj();
+ TclNewObj(varValuePtr);
createdNewObj = 1;
} else if (Tcl_IsShared(varValuePtr)) {
varValuePtr = Tcl_DuplicateObj(varValuePtr);
@@ -2703,11 +2703,11 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv)
}
searchPtr->nextEntry = Tcl_NextHashEntry(&searchPtr->search);
if (searchPtr->nextEntry == NULL) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0));
+ Tcl_SetObjResult(interp, iPtr->execEnvPtr->constants[0]);
return TCL_OK;
}
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1));
+ Tcl_SetObjResult(interp, iPtr->execEnvPtr->constants[1]);
break;
}
case ARRAY_DONESEARCH: {
@@ -2743,7 +2743,7 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(!notArray));
+ Tcl_SetObjResult(interp, iPtr->execEnvPtr->constants[!notArray]);
break;
}
case ARRAY_GET: {
@@ -2769,7 +2769,7 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv)
* Store the array names in a new object.
*/
- nameLstPtr = Tcl_NewObj();
+ TclNewObj(nameLstPtr);
Tcl_IncrRefCount(nameLstPtr);
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search);
@@ -2804,7 +2804,7 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv)
* Get the array values corresponding to each element name
*/
- tmpResPtr = Tcl_NewObj();
+ TclNewObj(tmpResPtr);
result = Tcl_ListObjGetElements(interp, nameLstPtr,
&count, &namePtrPtr);
if (result != TCL_OK) {
@@ -2841,7 +2841,7 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv)
}
varPtr->refCount--;
Tcl_SetObjResult(interp, tmpResPtr);
- Tcl_DecrRefCount(nameLstPtr);
+ TclDecrRefCount(nameLstPtr);
break;
errorInArrayGet:
@@ -2880,7 +2880,7 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
}
- resultPtr = Tcl_NewObj();
+ TclNewObj(resultPtr);
for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
varPtr2 = (Var *) Tcl_GetHashValue(hPtr);
@@ -4161,12 +4161,12 @@ TclDeleteVars(iPtr, tablePtr)
*/
if (varPtr->tracePtr != NULL) {
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr); /* until done with traces */
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr);
TclCallVarTraces(iPtr, (Var *) NULL, varPtr, TclGetString(objPtr),
NULL, flags, /* leaveErrMsg */ 0);
- Tcl_DecrRefCount(objPtr); /* free no longer needed obj */
+ TclDecrRefCount(objPtr); /* free no longer needed obj */
while (varPtr->tracePtr != NULL) {
VarTrace *tracePtr = varPtr->tracePtr;