Skip to content

Commit

Permalink
Merge branch 'tcltk:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mayhem-bot authored Jun 21, 2022
2 parents af50c65 + 26e99ba commit 6986ad1
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 93 deletions.
6 changes: 4 additions & 2 deletions doc/Tcl_Main.3
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ that does nothing but invoke \fBTcl_Main\fR.
.PP
\fBTcl_Main\fR is not provided by the public interface of Tcl's
stub library. Programs that call \fBTcl_Main\fR must be linked
against the standard Tcl library. Extensions (stub-enabled or
not) are not intended to call \fBTcl_Main\fR.
against the standard Tcl library. If the standard Tcl library is
a dll (so, not a static .lib/.a) , then the program must be linked
against the stub library as well. Extensions
(stub-enabled or not) are not intended to call \fBTcl_Main\fR.
.PP
\fBTcl_Main\fR is not thread-safe. It should only be called by
a single main thread of a multi-threaded application. This
Expand Down
2 changes: 1 addition & 1 deletion generic/tclInt.decls
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ declare 16 {
}
declare 22 {
int TclFindElement(Tcl_Interp *interp, const char *listStr,
int listLength, const char **elementPtr, const char **nextPtr,
size_t listLength, const char **elementPtr, const char **nextPtr,
size_t *sizePtr, int *bracePtr)
}
declare 23 {
Expand Down
4 changes: 2 additions & 2 deletions generic/tclIntDecls.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ EXTERN void TclExprFloatError(Tcl_Interp *interp, double value);
/* Slot 21 is reserved */
/* 22 */
EXTERN int TclFindElement(Tcl_Interp *interp,
const char *listStr, int listLength,
const char *listStr, size_t listLength,
const char **elementPtr,
const char **nextPtr, size_t *sizePtr,
int *bracePtr);
Expand Down Expand Up @@ -603,7 +603,7 @@ typedef struct TclIntStubs {
void (*reserved19)(void);
void (*reserved20)(void);
void (*reserved21)(void);
int (*tclFindElement) (Tcl_Interp *interp, const char *listStr, int listLength, const char **elementPtr, const char **nextPtr, size_t *sizePtr, int *bracePtr); /* 22 */
int (*tclFindElement) (Tcl_Interp *interp, const char *listStr, size_t listLength, const char **elementPtr, const char **nextPtr, size_t *sizePtr, int *bracePtr); /* 22 */
Proc * (*tclFindProc) (Interp *iPtr, const char *procName); /* 23 */
size_t (*tclFormatInt) (char *buffer, Tcl_WideInt n); /* 24 */
void (*tclFreePackageInfo) (Interp *iPtr); /* 25 */
Expand Down
2 changes: 1 addition & 1 deletion generic/tclProc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,7 @@ TclUpdateReturnInfo(
Tcl_ObjCmdProc *
TclGetObjInterpProc(void)
{
return (Tcl_ObjCmdProc *) TclObjInterpProc;
return TclObjInterpProc;
}

/*
Expand Down
18 changes: 8 additions & 10 deletions generic/tclUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ TclFindElement(
const char *list, /* Points to the first byte of a string
* containing a Tcl list with zero or more
* elements (possibly in braces). */
int listLength, /* Number of bytes in the list's string. */
size_t listLength, /* Number of bytes in the list's string. */
const char **elementPtr, /* Where to put address of first significant
* character in first element of list. */
const char **nextPtr, /* Fill in with location of character just
Expand Down Expand Up @@ -550,7 +550,7 @@ FindElement(
* containing a Tcl list or dictionary with
* zero or more elements (possibly in
* braces). */
size_t stringLength1, /* Number of bytes in the string. */
size_t stringLength, /* Number of bytes in the string. */
const char *typeStr, /* The name of the type of thing we are
* parsing, for error messages. */
const char *typeCode, /* The type code for thing we are parsing, for
Expand All @@ -572,13 +572,12 @@ FindElement(
const char *p = string;
const char *elemStart; /* Points to first byte of first element. */
const char *limit; /* Points just after list/dict's last byte. */
int openBraces = 0; /* Brace nesting level during parse. */
size_t openBraces = 0; /* Brace nesting level during parse. */
int inQuotes = 0;
int size = 0;
size_t size = 0;
size_t numChars;
int literal = 1;
const char *p2;
int stringLength = stringLength1;

/*
* Skim off leading white space and check for an opening brace or quote.
Expand Down Expand Up @@ -976,7 +975,7 @@ Tcl_ScanCountedElement(
* Tcl_ConvertElement. */
{
char flags = CONVERT_ANY;
int numBytes = TclScanElement(src, length, &flags);
size_t numBytes = TclScanElement(src, length, &flags);

*flagPtr = flags;
return numBytes;
Expand Down Expand Up @@ -1020,7 +1019,7 @@ TclScanElement(
* Tcl_ConvertElement. */
{
const char *p = src;
int nestingLevel = 0; /* Brace nesting count */
size_t nestingLevel = 0; /* Brace nesting count */
int forbidNone = 0; /* Do not permit CONVERT_NONE mode. Something
* needs protection or escape. */
int requireEscape = 0; /* Force use of CONVERT_ESCAPE mode. For some
Expand Down Expand Up @@ -1089,8 +1088,7 @@ TclScanElement(
braceCount++;
#endif /* COMPAT */
extra++; /* Escape '}' => '\}' */
nestingLevel--;
if (nestingLevel < 0) {
if (nestingLevel-- < 1) {
/*
* Unbalanced braces! Cannot format with brace quoting.
*/
Expand Down Expand Up @@ -1171,7 +1169,7 @@ TclScanElement(
}

endOfString:
if (nestingLevel != 0) {
if (nestingLevel > 0) {
/*
* Unbalanced braces! Cannot format with brace quoting.
*/
Expand Down
Loading

0 comments on commit 6986ad1

Please sign in to comment.