Skip to content

Commit

Permalink
Make Tcl_GetString() a macro calling Tcl_GetStringFromObj(). Just the…
Browse files Browse the repository at this point in the history
… same as Tcl_GetUnicode().
  • Loading branch information
jan.nijtmans committed Jan 25, 2021
1 parent 6eb88bd commit 8dc15fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions generic/tclDecls.h
Original file line number Diff line number Diff line change
Expand Up @@ -4138,7 +4138,10 @@ extern const TclStubs *tclStubsPtr;
# endif
#endif

#undef Tcl_GetString
#undef Tcl_GetUnicode
#define Tcl_GetString(objPtr) \
Tcl_GetStringFromObj(objPtr, (int *)NULL)
#define Tcl_GetUnicode(objPtr) \
Tcl_GetUnicodeFromObj(objPtr, (int *)NULL)
#ifdef TCL_NO_DEPRECATED
Expand Down
1 change: 1 addition & 0 deletions generic/tclObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,7 @@ TclSetDuplicateObj(
*----------------------------------------------------------------------
*/

#undef Tcl_GetString
char *
Tcl_GetString(
Tcl_Obj *objPtr) /* Object whose string rep byte pointer should
Expand Down
6 changes: 3 additions & 3 deletions generic/tclTestObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ TeststringobjCmd(
{
Tcl_UniChar *unicode;
int varIndex, option, i, length;
size_t size;
int size;
#define MAX_STRINGS 11
const char *index, *string, *strings[MAX_STRINGS+1];
String *strPtr;
Expand Down Expand Up @@ -1371,7 +1371,7 @@ TeststringobjCmd(
if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) {
return TCL_ERROR;
}
if ((i < 0) || ((size_t)i > size)) {
if ((i < 0) || (i > size)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"index value out of range", -1));
return TCL_ERROR;
Expand Down Expand Up @@ -1402,7 +1402,7 @@ TeststringobjCmd(
if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) {
return TCL_ERROR;
}
if ((i < 0) || ((size_t)i > size)) {
if ((i < 0) || (i > size)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"index value out of range", -1));
return TCL_ERROR;
Expand Down

0 comments on commit 8dc15fd

Please sign in to comment.