diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-17 13:48:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-17 13:48:12 (GMT) |
commit | 831357beb0b7168e132a14e0a4c1e16015db8462 (patch) | |
tree | 2c38bde59af6c90ad19dbda96878de709d5859d0 /generic/tclResult.c | |
parent | cd18bd65e2e4f265f35f06ab75e62600c1f49006 (diff) | |
download | tcl-831357beb0b7168e132a14e0a4c1e16015db8462.zip tcl-831357beb0b7168e132a14e0a4c1e16015db8462.tar.gz tcl-831357beb0b7168e132a14e0a4c1e16015db8462.tar.bz2 |
Eliminate many usages of Tcl_NewObj (-> TclNewObj) and Tcl_NewIntObj (-> TclNewIntObj or Tcl_NewWideIntObj)
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r-- | generic/tclResult.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c index baecf46..4b9df6c 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -248,7 +248,7 @@ Tcl_SaveResult( */ statePtr->objResultPtr = iPtr->objResultPtr; - iPtr->objResultPtr = Tcl_NewObj(); + TclNewObj(iPtr->objResultPtr); Tcl_IncrRefCount(iPtr->objResultPtr); /* @@ -1036,13 +1036,14 @@ Tcl_SetErrorCodeVA( Tcl_Interp *interp, /* Interpreter in which to set errorCode */ va_list argList) /* Variable argument list. */ { - Tcl_Obj *errorObj = Tcl_NewObj(); + Tcl_Obj *errorObj; /* * Scan through the arguments one at a time, appending them to the * errorCode field as list elements. */ + TclNewObj(errorObj); while (1) { char *elem = va_arg(argList, char *); @@ -1395,9 +1396,10 @@ TclMergeReturnOptions( int code = TCL_OK; int level = 1; Tcl_Obj *valuePtr; - Tcl_Obj *returnOpts = Tcl_NewObj(); + Tcl_Obj *returnOpts; Tcl_Obj **keys = GetKeys(); + TclNewObj(returnOpts); for (; objc > 1; objv += 2, objc -= 2) { const char *opt = TclGetString(objv[0]); const char *compare = TclGetString(keys[KEY_OPTIONS]); @@ -1591,19 +1593,19 @@ Tcl_GetReturnOptions( if (iPtr->returnOpts) { options = Tcl_DuplicateObj(iPtr->returnOpts); } else { - options = Tcl_NewObj(); + TclNewObj(options); } if (result == TCL_RETURN) { Tcl_DictObjPut(NULL, options, keys[KEY_CODE], - Tcl_NewIntObj(iPtr->returnCode)); + Tcl_NewWideIntObj(iPtr->returnCode)); Tcl_DictObjPut(NULL, options, keys[KEY_LEVEL], - Tcl_NewIntObj(iPtr->returnLevel)); + Tcl_NewWideIntObj(iPtr->returnLevel)); } else { Tcl_DictObjPut(NULL, options, keys[KEY_CODE], - Tcl_NewIntObj(result)); + Tcl_NewWideIntObj(result)); Tcl_DictObjPut(NULL, options, keys[KEY_LEVEL], - Tcl_NewIntObj(0)); + Tcl_NewWideIntObj(0)); } if (result == TCL_ERROR) { @@ -1616,7 +1618,7 @@ Tcl_GetReturnOptions( if (iPtr->errorInfo) { Tcl_DictObjPut(NULL, options, keys[KEY_ERRORINFO], iPtr->errorInfo); Tcl_DictObjPut(NULL, options, keys[KEY_ERRORLINE], - Tcl_NewIntObj(iPtr->errorLine)); + Tcl_NewWideIntObj(iPtr->errorLine)); } return options; } |