summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tcl.decls6
-rw-r--r--generic/tclDecls.h9
-rw-r--r--generic/tclInt.h4
-rw-r--r--generic/tclObj.c25
-rw-r--r--generic/tclStringObj.c4
-rw-r--r--generic/tclStubInit.c2
6 files changed, 42 insertions, 8 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index e01bdd9..a888ec8 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2626,6 +2626,12 @@ declare 685 {
Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr)
}
+# TIP 660
+declare 686 {
+ int Tcl_GetSizeIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
+ Tcl_Size *sizePtr)
+}
+
# ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- #
declare 687 {
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 9bf0b7b..308168d 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -1861,7 +1861,9 @@ EXTERN int Tcl_GetWideUIntFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr);
/* 685 */
EXTERN Tcl_Obj * Tcl_DStringToObj(Tcl_DString *dsPtr);
-/* Slot 686 is reserved */
+/* 686 */
+EXTERN int Tcl_GetSizeIntFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Tcl_Size *sizePtr);
/* 687 */
EXTERN void TclUnusedStubEntry(void);
@@ -2561,7 +2563,7 @@ typedef struct TclStubs {
Tcl_Size (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
int (*tcl_GetWideUIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); /* 684 */
Tcl_Obj * (*tcl_DStringToObj) (Tcl_DString *dsPtr); /* 685 */
- void (*reserved686)(void);
+ int (*tcl_GetSizeIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *sizePtr); /* 686 */
void (*tclUnusedStubEntry) (void); /* 687 */
} TclStubs;
@@ -3887,7 +3889,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetWideUIntFromObj) /* 684 */
#define Tcl_DStringToObj \
(tclStubsPtr->tcl_DStringToObj) /* 685 */
-/* Slot 686 is reserved */
+#define Tcl_GetSizeIntFromObj \
+ (tclStubsPtr->tcl_GetSizeIntFromObj) /* 686 */
#define TclUnusedStubEntry \
(tclStubsPtr->tclUnusedStubEntry) /* 687 */
diff --git a/generic/tclInt.h b/generic/tclInt.h
index e65a3ee..3598388 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4182,7 +4182,7 @@ MODULE_SCOPE int TclIndexInvalidError(Tcl_Interp *interp,
/*
*------------------------------------------------------------------------
*
- * TclGetSizeFromObj --
+ * TclGetSizeIntFromObj --
*
* Extract a Tcl_Size from a Tcl_Obj
*
@@ -4195,7 +4195,7 @@ MODULE_SCOPE int TclIndexInvalidError(Tcl_Interp *interp,
*
*------------------------------------------------------------------------
*/
-static inline int TclGetSizeFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *sizePtr) {
+static inline int TclGetSizeIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *sizePtr) {
#if TCL_SIZE_MAX == INT_MAX
return TclGetIntFromObj(interp, objPtr, sizePtr);
#else
diff --git a/generic/tclObj.c b/generic/tclObj.c
index d0daa24..87b2d6d 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3134,6 +3134,31 @@ TclGetWideBitsFromObj(
/*
*----------------------------------------------------------------------
*
+ * Tcl_GetSizeIntFromObj --
+ *
+ * Attempt to return a Tcl_Size from the Tcl object "objPtr".
+ *
+ * Results:
+ * TCL_OK - the converted Tcl_Size value is stored in *sizePtr
+ * TCL_ERROR - the error message is stored in interp
+ *
+ * Side effects:
+ * The function may free up any existing internal representation.
+ *
+ *----------------------------------------------------------------------
+ */
+int
+Tcl_GetSizeIntFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get a int. */
+ Tcl_Size *sizePtr) /* Place to store resulting int. */
+{
+ return TclGetSizeIntFromObj(interp, objPtr, sizePtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* FreeBignum --
*
* This function frees the internal rep of a bignum.
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 08c96f0..7f310ce 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2019,7 +2019,7 @@ Tcl_AppendFormatToObj(
errCode = gotXpg ? "INDEXRANGE" : "FIELDVARMISMATCH";
goto errorMsg;
}
- if (TclGetSizeFromObj(interp, objv[objIndex], &width) != TCL_OK) {
+ if (TclGetSizeIntFromObj(interp, objv[objIndex], &width) != TCL_OK) {
goto error;
}
if (width < 0) {
@@ -2056,7 +2056,7 @@ Tcl_AppendFormatToObj(
errCode = gotXpg ? "INDEXRANGE" : "FIELDVARMISMATCH";
goto errorMsg;
}
- if (TclGetSizeFromObj(interp, objv[objIndex], &precision)
+ if (TclGetSizeIntFromObj(interp, objv[objIndex], &precision)
!= TCL_OK) {
goto error;
}
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 7c27293..7ee7eae 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -1492,7 +1492,7 @@ const TclStubs tclStubs = {
Tcl_GetEncodingNulLength, /* 683 */
Tcl_GetWideUIntFromObj, /* 684 */
Tcl_DStringToObj, /* 685 */
- 0, /* 686 */
+ Tcl_GetSizeIntFromObj, /* 686 */
TclUnusedStubEntry, /* 687 */
};