Subject: Consolidate some helper routines.

From: dgp <[email-masked]>
Date: Wed, 14 Aug 2013 12:15:59 +0000

---
 generic/tclCmdIL.c   | 19 -------------------
 generic/tclExecute.c | 27 +++++++++++++++++++--------
 generic/tclInt.h     |  2 --
 3 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index da9edd6..fa4ead4 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1266,25 +1266,6 @@ InfoFrameCmd(
  */
 
 Tcl_Obj *
-TclGetSourceFromFrame(
-    CmdFrame *cfPtr,
-    int objc,
-    Tcl_Obj *const objv[])
-{
-    if (cfPtr == NULL) {
-	return Tcl_NewListObj(objc, objv);
-    }
-    if (cfPtr->cmdObj == NULL) {
-	if (cfPtr->cmd == NULL) {
-	    cfPtr->cmd = TclGetSrcInfoForCmdFrame(cfPtr, &cfPtr->len);
-	}
-	cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len);
-	Tcl_IncrRefCount(cfPtr->cmdObj);
-    }
-    return cfPtr->cmdObj;
-}
-
-Tcl_Obj *
 TclInfoFrame(
     Tcl_Interp *interp,		/* Current interpreter. */
     CmdFrame *framePtr)		/* Frame to get info for. */
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 58e4d3d..d066476 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -8740,7 +8740,7 @@ IllegalExprOperandType(
 /*
  *----------------------------------------------------------------------
  *
- * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSrcInfoForCmdFrame --
+ * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSourceFromFrame --
  *
  *	Given a program counter value, finds the closest command in the
  *	bytecode code unit's CmdLocation array and returns information about
@@ -8761,15 +8761,26 @@ IllegalExprOperandType(
  *----------------------------------------------------------------------
  */
 
-const char *
-TclGetSrcInfoForCmdFrame(
+Tcl_Obj *
+TclGetSourceFromFrame(
     CmdFrame *cfPtr,
-    int *lenPtr)
+    int objc,
+    Tcl_Obj *const objv[])
 {
-    ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr;
-
-    return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc,
-	    codePtr, lenPtr, NULL, NULL);
+    if (cfPtr == NULL) {
+        return Tcl_NewListObj(objc, objv);
+    }
+    if (cfPtr->cmdObj == NULL) {
+        if (cfPtr->cmd == NULL) {
+	    ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr;
+
+            cfPtr->cmd = GetSrcInfoForPc((unsigned char *)
+		    cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL);
+        }
+        cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len);
+        Tcl_IncrRefCount(cfPtr->cmdObj);
+    }
+    return cfPtr->cmdObj;
 }
 
 void
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 19cd883..6056119 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2909,8 +2909,6 @@ MODULE_SCOPE int	TclGetOpenModeEx(Tcl_Interp *interp,
 MODULE_SCOPE Tcl_Obj *	TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr);
 MODULE_SCOPE Tcl_Obj *	TclGetSourceFromFrame(CmdFrame *cfPtr, int objc,
 			    Tcl_Obj *const objv[]);
-MODULE_SCOPE const char *TclGetSrcInfoForCmdFrame(CmdFrame *cfPtr,
-			    int *lenPtr);
 MODULE_SCOPE int	TclGlob(Tcl_Interp *interp, char *pattern,
 			    Tcl_Obj *unquotedPrefix, int globFlags,
 			    Tcl_GlobTypeData *types);
-- 
cgit v0.12