summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-18 13:47:08 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-18 13:47:08 (GMT)
commit2acbdb04938db272c3e0bfcedbd3d78d788a9833 (patch)
treef9a69bc7362f766b14095d86dc2f8b74f5b4f7d3 /generic/tclResult.c
parente00ad288cc9b6a7e9f95f74fd040d9ea8d21fe55 (diff)
downloadtcl-2acbdb04938db272c3e0bfcedbd3d78d788a9833.zip
tcl-2acbdb04938db272c3e0bfcedbd3d78d788a9833.tar.gz
tcl-2acbdb04938db272c3e0bfcedbd3d78d788a9833.tar.bz2
Remove all VA functions Tcl_AppendResultVA, Tcl_AppendStringsToObjVA, Tcl_SetErrorCodeVA, Tcl_PanicVA, and dependancy of tcl.h on <stdarg.h>. TIP required.
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r--generic/tclResult.c103
1 files changed, 28 insertions, 75 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 618b7d8..ad45c41 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -444,41 +444,6 @@ Tcl_GetObjResult(
/*
*----------------------------------------------------------------------
*
- * Tcl_AppendResultVA --
- *
- * Append a variable number of strings onto the interpreter's result.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The result of the interpreter given by the first argument is extended
- * by the strings in the va_list (up to a terminating NULL argument).
- *
- * If the string result is non-empty, the object result forced to be a
- * duplicate of it first. There will be a string result afterwards.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_AppendResultVA(
- Tcl_Interp *interp, /* Interpreter with which to associate the
- * return value. */
- va_list argList) /* Variable argument list. */
-{
- Tcl_Obj *objPtr = Tcl_GetObjResult(interp);
-
- if (Tcl_IsShared(objPtr)) {
- objPtr = Tcl_DuplicateObj(objPtr);
- }
- Tcl_AppendStringsToObjVA(objPtr, argList);
- Tcl_SetObjResult(interp, objPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_AppendResult --
*
* Append a variable number of strings onto the interpreter's result.
@@ -502,9 +467,23 @@ Tcl_AppendResult(
Tcl_Interp *interp, ...)
{
va_list argList;
+ Tcl_Obj *objPtr;
va_start(argList, interp);
- Tcl_AppendResultVA(interp, argList);
+ objPtr = Tcl_GetObjResult(interp);
+
+ if (Tcl_IsShared(objPtr)) {
+ objPtr = Tcl_DuplicateObj(objPtr);
+ }
+ while (1) {
+ const char *bytes = va_arg(argList, char *);
+
+ if (bytes == NULL) {
+ break;
+ }
+ Tcl_AppendToObj(objPtr, bytes, -1);
+ }
+ Tcl_SetObjResult(interp, objPtr);
va_end(argList);
}
@@ -684,7 +663,7 @@ ResetObjResult(
/*
*----------------------------------------------------------------------
*
- * Tcl_SetErrorCodeVA --
+ * Tcl_SetErrorCode --
*
* This function is called to record machine-readable information about
* an error that is about to be returned.
@@ -701,11 +680,19 @@ ResetObjResult(
*/
void
-Tcl_SetErrorCodeVA(
- Tcl_Interp *interp, /* Interpreter in which to set errorCode */
- va_list argList) /* Variable argument list. */
+Tcl_SetErrorCode(
+ Tcl_Interp *interp, ...)
{
- Tcl_Obj *errorObj = Tcl_NewObj();
+ va_list argList;
+ Tcl_Obj *errorObj;
+
+ /*
+ * Scan through the arguments one at a time, appending them to the
+ * errorCode field as list elements.
+ */
+
+ va_start(argList, interp);
+ errorObj = Tcl_NewObj();
/*
* Scan through the arguments one at a time, appending them to the
@@ -721,40 +708,6 @@ Tcl_SetErrorCodeVA(
Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, -1));
}
Tcl_SetObjErrorCode(interp, errorObj);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_SetErrorCode --
- *
- * This function is called to record machine-readable information about
- * an error that is about to be returned.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The errorCode field of the interp is modified to hold all of the
- * arguments to this function, in a list form with each argument becoming
- * one element of the list.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tcl_SetErrorCode(
- Tcl_Interp *interp, ...)
-{
- va_list argList;
-
- /*
- * Scan through the arguments one at a time, appending them to the
- * errorCode field as list elements.
- */
-
- va_start(argList, interp);
- Tcl_SetErrorCodeVA(interp, argList);
va_end(argList);
}