Skip to content

Commit

Permalink
Fix [f4b0cb2080] by only accepting new syntax when TCL_NO_DEPRECATED …
Browse files Browse the repository at this point in the history
…is defined
  • Loading branch information
jan.nijtmans committed Jan 25, 2021
1 parent 7755e44 commit 6eb88bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion doc/ByteArrObj.3
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ byte-array type. For \fBTcl_GetByteArrayFromObj\fR and
the byte-array value; if \fIobjPtr\fR does not already point to a byte-array
value, it will be converted to one.
.AP size_t | int *lengthPtr out
If non-NULL, filled with the length of the array of bytes in the value.
Filled with the length of the array of bytes in the value.
May be (int *)NULL when not used.
.BE

.SH DESCRIPTION
Expand Down
4 changes: 2 additions & 2 deletions doc/StringObj.3
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ Points to a value to manipulate.
.AP Tcl_Obj *appendObjPtr in
The value to append to \fIobjPtr\fR in \fBTcl_AppendObjToObj\fR.
.AP size_t | int *lengthPtr out
If non-NULL, the location where \fBTcl_GetStringFromObj\fR will store
the length of a value's string representation.
The location where \fBTcl_GetStringFromObj\fR will store the length
of a value's string representation. May be (int *)NULL when not used.
.AP "const char" *string in
Null-terminated string value to append to \fIobjPtr\fR.
.AP va_list argList in
Expand Down
14 changes: 9 additions & 5 deletions generic/tclDecls.h
Original file line number Diff line number Diff line change
Expand Up @@ -4138,28 +4138,32 @@ extern const TclStubs *tclStubsPtr;
# endif
#endif

#undef Tcl_GetUnicode
#define Tcl_GetUnicode(objPtr) \
Tcl_GetUnicodeFromObj(objPtr, (int *)NULL)
#ifdef TCL_NO_DEPRECATED
#undef Tcl_GetStringFromObj
#undef Tcl_GetUnicodeFromObj
#undef Tcl_GetByteArrayFromObj
#undef Tcl_GetUnicode
#endif
#if defined(USE_TCL_STUBS)
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)sizePtr))
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (size_t *)sizePtr))
#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (size_t *)sizePtr))
#define Tcl_GetUnicode(objPtr) \
tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, NULL)
#endif
#else
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)sizePtr) : (TclGetStringFromObj)(objPtr, (size_t *)sizePtr))
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)sizePtr) : TclGetByteArrayFromObj(objPtr, (size_t *)sizePtr))
#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetUnicodeFromObj)(objPtr, (int *)sizePtr) : TclGetUnicodeFromObj(objPtr, (size_t *)sizePtr))
#define Tcl_GetUnicode(objPtr) \
(Tcl_GetUnicodeFromObj)(objPtr, NULL)
#endif
#endif

#undef Tcl_NewLongObj
Expand Down

0 comments on commit 6eb88bd

Please sign in to comment.