summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-06-01 16:13:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-06-01 16:13:39 (GMT)
commit4a25523bd51f705a6a6aad227de13267caef05dc (patch)
tree528ef69b321212a720a4ab82576c88bfcee3621e
parent4b02aec22c3f21d2039edd7f7143abe460fdb5b4 (diff)
downloadtcl-4a25523bd51f705a6a6aad227de13267caef05dc.zip
tcl-4a25523bd51f705a6a6aad227de13267caef05dc.tar.gz
tcl-4a25523bd51f705a6a6aad227de13267caef05dc.tar.bz2
Some tidying up, mostly of indentation
-rw-r--r--generic/tclParse.c4
-rw-r--r--generic/tclParse.h25
-rw-r--r--generic/tclPathObj.c28
-rw-r--r--generic/tclPipe.c2
-rw-r--r--generic/tclPkgConfig.c2
-rw-r--r--generic/tclPreserve.c13
-rw-r--r--generic/tclProc.c2
-rw-r--r--generic/tclRegexp.c10
-rw-r--r--generic/tclResult.c4
-rw-r--r--generic/tclScan.c17
-rw-r--r--generic/tclStrToD.c15
-rw-r--r--generic/tclStringObj.c42
12 files changed, 84 insertions, 80 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index e88de0b..dca351c 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -1039,7 +1039,7 @@ ParseComment(
static int
ParseTokens(
- const char *src, /* First character to parse. */
+ const char *src, /* First character to parse. */
Tcl_Size numBytes, /* Max number of bytes to scan. */
int mask, /* Specifies when to stop parsing. The parse
* stops at the first unquoted character whose
@@ -1531,7 +1531,7 @@ Tcl_ParseVarName(
const char *
Tcl_ParseVar(
Tcl_Interp *interp, /* Context for looking up variable. */
- const char *start, /* Start of variable substitution. First
+ const char *start, /* Start of variable substitution. First
* character must be "$". */
const char **termPtr) /* If non-NULL, points to word to fill in with
* character just after last one in the
diff --git a/generic/tclParse.h b/generic/tclParse.h
index b28ac8c..1381b30 100644
--- a/generic/tclParse.h
+++ b/generic/tclParse.h
@@ -1,18 +1,21 @@
/*
- * Minimal set of shared macro definitions and declarations so that multiple
+ * Minimal set of shared flag definitions and declarations so that multiple
* source files can make use of the parsing table in tclParse.c
*/
-#define TYPE_NORMAL 0
-#define TYPE_SPACE 0x1
-#define TYPE_COMMAND_END 0x2
-#define TYPE_SUBS 0x4
-#define TYPE_QUOTE 0x8
-#define TYPE_CLOSE_PAREN 0x10
-#define TYPE_CLOSE_BRACK 0x20
-#define TYPE_BRACE 0x40
-#define TYPE_OPEN_PAREN 0x80
-#define TYPE_BAD_ARRAY_INDEX (TYPE_OPEN_PAREN|TYPE_CLOSE_PAREN|TYPE_QUOTE|TYPE_BRACE)
+enum ParseTypeFlags {
+ TYPE_NORMAL = 0,
+ TYPE_SPACE = 0x1,
+ TYPE_COMMAND_END = 0x2,
+ TYPE_SUBS = 0x4,
+ TYPE_QUOTE = 0x8,
+ TYPE_CLOSE_PAREN = 0x10,
+ TYPE_CLOSE_BRACK = 0x20,
+ TYPE_BRACE = 0x40,
+ TYPE_OPEN_PAREN = 0x80,
+ TYPE_BAD_ARRAY_INDEX = (
+ TYPE_OPEN_PAREN | TYPE_CLOSE_PAREN | TYPE_QUOTE | TYPE_BRACE)
+};
#define CHAR_TYPE(c) tclCharTypeTable[(unsigned char)(c)]
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 9a44863..7664827 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -40,11 +40,11 @@ static int MakeTildeRelativePath(Tcl_Interp *interp,
*/
static const Tcl_ObjType fsPathType = {
- "path", /* name */
- FreeFsPathInternalRep, /* freeIntRepProc */
- DupFsPathInternalRep, /* dupIntRepProc */
- UpdateStringOfFsPath, /* updateStringProc */
- SetFsPathFromAny, /* setFromAnyProc */
+ "path", /* name */
+ FreeFsPathInternalRep, /* freeIntRepProc */
+ DupFsPathInternalRep, /* dupIntRepProc */
+ UpdateStringOfFsPath, /* updateStringProc */
+ SetFsPathFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
@@ -2347,7 +2347,7 @@ DupFsPathInternalRep(
static void
UpdateStringOfFsPath(
- Tcl_Obj *pathPtr) /* path obj with string rep to update. */
+ Tcl_Obj *pathPtr) /* path obj with string rep to update. */
{
FsPath *fsPathPtr = PATHOBJ(pathPtr);
Tcl_Size cwdLen;
@@ -2469,11 +2469,11 @@ TclNativePathInFilesystem(
*/
int
MakeTildeRelativePath(
- Tcl_Interp *interp, /* May be NULL. Only used for error messages */
- const char *user, /* User name. NULL -> current user */
- const char *subPath, /* Rest of path. May be NULL */
- Tcl_DString *dsPtr) /* Output. Is initialized by the function. Must be
- * freed on success */
+ Tcl_Interp *interp, /* May be NULL. Only used for error messages */
+ const char *user, /* User name. NULL -> current user */
+ const char *subPath, /* Rest of path. May be NULL */
+ Tcl_DString *dsPtr) /* Output. Is initialized by the function. Must
+ * be freed on success */
{
const char *dir;
Tcl_DString dirString;
@@ -2537,8 +2537,8 @@ MakeTildeRelativePath(
*/
Tcl_Obj *
TclGetHomeDirObj(
- Tcl_Interp *interp, /* May be NULL. Only used for error messages */
- const char *user) /* User name. NULL -> current user */
+ Tcl_Interp *interp, /* May be NULL. Only used for error messages */
+ const char *user) /* User name. NULL -> current user */
{
Tcl_DString dirString;
@@ -2569,7 +2569,7 @@ TclGetHomeDirObj(
*/
Tcl_Obj *
TclResolveTildePath(
- Tcl_Interp *interp, /* May be NULL. Only used for error messages */
+ Tcl_Interp *interp, /* May be NULL. Only used for error messages */
Tcl_Obj *pathObj)
{
const char *path;
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 73f291a..1efe1ba 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -1021,7 +1021,7 @@ Tcl_Channel
Tcl_OpenCommandChannel(
Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
* NULL. */
- Tcl_Size argc, /* How many arguments. */
+ Tcl_Size argc, /* How many arguments. */
const char **argv, /* Array of arguments for command pipe. */
int flags) /* Or'ed combination of TCL_STDIN, TCL_STDOUT,
* TCL_STDERR, and TCL_ENFORCE_MODE. */
diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c
index d84472c..40ec9d0 100644
--- a/generic/tclPkgConfig.c
+++ b/generic/tclPkgConfig.c
@@ -22,7 +22,7 @@
* - TCL_COMPILE_STATS OSCMa bytecode compiler statistics.
*
* - TCL_CFG_DO64BIT NSCMdt tcl is compiled for a 64bit system.
- * - NDEBUG NSCMdt tcl is compiled with symbol info off.
+ * - NDEBUG NSCMdt tcl is compiled with symbol info off.
* - TCL_CFG_OPTIMIZED NSCMdt tcl is compiled with cc optimizations on
* - TCL_CFG_PROFILED NSCMdt tcl is compiled with profiling info.
*
diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c
index 36a9537..58bc82d 100644
--- a/generic/tclPreserve.c
+++ b/generic/tclPreserve.c
@@ -21,7 +21,7 @@
*/
typedef struct {
- void *clientData; /* Address of preserved block. */
+ void *clientData; /* Address of preserved block. */
size_t refCount; /* Number of Tcl_Preserve calls in effect for
* block. */
int mustFree; /* Non-zero means Tcl_EventuallyFree was
@@ -36,10 +36,11 @@ typedef struct {
* These variables are protected by "preserveMutex".
*/
-static Reference *refArray = NULL; /* First in array of references. */
+static Reference *refArray = NULL;
+ /* First in array of references. */
static size_t spaceAvl = 0; /* Total number of structures available at
* *firstRefPtr. */
-static size_t inUse = 0; /* Count of structures currently in use in
+static size_t inUse = 0; /* Count of structures currently in use in
* refArray. */
TCL_DECLARE_MUTEX(preserveMutex)/* To protect the above statics */
@@ -117,7 +118,7 @@ TclFinalizePreserve(void)
void
Tcl_Preserve(
- void *clientData) /* Pointer to malloc'ed block of memory. */
+ void *clientData) /* Pointer to malloc'ed block of memory. */
{
Reference *refPtr;
size_t i;
@@ -180,7 +181,7 @@ Tcl_Preserve(
void
Tcl_Release(
- void *clientData) /* Pointer to malloc'ed block of memory. */
+ void *clientData) /* Pointer to malloc'ed block of memory. */
{
Reference *refPtr;
size_t i;
@@ -259,7 +260,7 @@ Tcl_Release(
void
Tcl_EventuallyFree(
- void *clientData, /* Pointer to malloc'ed block of memory. */
+ void *clientData, /* Pointer to malloc'ed block of memory. */
Tcl_FreeProc *freeProc) /* Function to actually do free. */
{
Reference *refPtr;
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 2f87048..8e752ed 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -2108,7 +2108,7 @@ MakeProcError(
void
TclProcDeleteProc(
- void *clientData) /* Procedure to be deleted. */
+ void *clientData) /* Procedure to be deleted. */
{
Proc *procPtr = (Proc *)clientData;
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 04f060b..caf6461 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -103,11 +103,11 @@ static int SetRegexpFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
*/
const Tcl_ObjType tclRegexpType = {
- "regexp", /* name */
- FreeRegexpInternalRep, /* freeIntRepProc */
- DupRegexpInternalRep, /* dupIntRepProc */
- NULL, /* updateStringProc */
- SetRegexpFromAny, /* setFromAnyProc */
+ "regexp", /* name */
+ FreeRegexpInternalRep, /* freeIntRepProc */
+ DupRegexpInternalRep, /* dupIntRepProc */
+ NULL, /* updateStringProc */
+ SetRegexpFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 7151fc4..f205b47 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -388,7 +388,7 @@ Tcl_AppendElement(
void
Tcl_ResetResult(
- Tcl_Interp *interp)/* Interpreter for which to clear result. */
+ Tcl_Interp *interp) /* Interpreter for which to clear result. */
{
Interp *iPtr = (Interp *) interp;
@@ -441,7 +441,7 @@ Tcl_ResetResult(
static void
ResetObjResult(
- Interp *iPtr) /* Points to the interpreter whose result
+ Interp *iPtr) /* Points to the interpreter whose result
* object should be reset. */
{
Tcl_Obj *objResultPtr = iPtr->objResultPtr;
diff --git a/generic/tclScan.c b/generic/tclScan.c
index cccdd7a..9a9e773 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -16,14 +16,15 @@
/*
* Flag values used by Tcl_ScanObjCmd.
*/
-
-#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */
-#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */
-#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */
-#define SCAN_WIDTH 0x8 /* A width value was supplied. */
-
-#define SCAN_LONGER 0x400 /* Asked for a wide value. */
-#define SCAN_BIG 0x800 /* Asked for a bignum value. */
+enum ScanFlags {
+ SCAN_NOSKIP = 0x1, /* Don't skip blanks. */
+ SCAN_SUPPRESS = 0x2, /* Suppress assignment. */
+ SCAN_UNSIGNED = 0x4, /* Read an unsigned value. */
+ SCAN_WIDTH = 0x8, /* A width value was supplied. */
+
+ SCAN_LONGER = 0x400, /* Asked for a wide value. */
+ SCAN_BIG = 0x800 /* Asked for a bignum value. */
+};
/*
* The following structure contains the information associated with a
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index ee21cf8..59decd9 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -1696,7 +1696,7 @@ MakeLowPrecisionDouble(
* ulp, so we need to change rounding mode to 53-bits. We also make
* 'retval' volatile, so that it doesn't get promoted to a register.
*/
- volatile double retval; /* Value of the number. */
+ volatile double retval; /* Value of the number. */
/*
* Test for zero significand, which requires explicit construction
@@ -2652,7 +2652,7 @@ ComputeScale(
static inline void
SetPrecisionLimits(
- int flags, /* Type of conversion: TCL_DD_SHORTEST,
+ int flags, /* Type of conversion: TCL_DD_SHORTEST,
* TCL_DD_E_FMT, TCL_DD_F_FMT. */
int k, /* Floor(log10(number to convert)) */
int *ndigitsPtr, /* IN/OUT: Number of digits requested (will be
@@ -3433,7 +3433,8 @@ ShouldBankerRoundUpToNextPowD(
* 2**(MP_DIGIT_BIT*sd)
*/
- if ((mp_add(b, m, temp) != MP_OKAY) || (temp->used <= sd)) { /* Too few digits to be > s */
+ if ((mp_add(b, m, temp) != MP_OKAY) || (temp->used <= sd)) {
+ /* Too few digits to be > s */
return 0;
}
if (temp->used > sd+1 || temp->dp[sd] > 1) {
@@ -4808,7 +4809,7 @@ Tcl_InitBignumFromDouble(
err = mp_init_i64(b, w);
if (err != MP_OKAY) {
- /* just skip */
+ /* just skip */
} else if (shift < 0) {
err = mp_div_2d(b, -shift, b, NULL);
} else if (shift > 0) {
@@ -4838,7 +4839,7 @@ Tcl_InitBignumFromDouble(
double
TclBignumToDouble(
- const void *big) /* Integer to convert. */
+ const void *big) /* Integer to convert. */
{
mp_int b;
int bits, shift, i, lsb;
@@ -4959,7 +4960,7 @@ TclBignumToDouble(
double
TclCeil(
- const void *big) /* Integer to convert. */
+ const void *big) /* Integer to convert. */
{
double r = 0.0;
mp_int b;
@@ -5025,7 +5026,7 @@ TclCeil(
double
TclFloor(
- const void *big) /* Integer to convert. */
+ const void *big) /* Integer to convert. */
{
double r = 0.0;
mp_int b;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 827c227..5793f65 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -124,8 +124,8 @@ const Tcl_ObjType tclStringType = {
static void
GrowStringBuffer(
Tcl_Obj *objPtr,
- Tcl_Size needed, /* Not including terminating nul */
- int flag) /* If 0, try to overallocate */
+ Tcl_Size needed, /* Not including terminating nul */
+ int flag) /* If 0, try to overallocate */
{
/*
* Preconditions:
@@ -718,8 +718,8 @@ Tcl_GetUnicodeFromObj(
Tcl_Obj *
Tcl_GetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
- Tcl_Size first, /* First index of the range. */
- Tcl_Size last) /* Last index of the range. */
+ Tcl_Size first, /* First index of the range. */
+ Tcl_Size last) /* Last index of the range. */
{
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
String *stringPtr;
@@ -3051,11 +3051,9 @@ TclStringRepeat(
/* maxCount includes space for null */
if (count > (maxCount-1)) {
if (interp) {
- Tcl_SetObjResult(
- interp,
- Tcl_ObjPrintf("max size for a Tcl value (%" TCL_SIZE_MODIFIER
- "d bytes) exceeded",
- TCL_SIZE_MAX));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "max size for a Tcl value (%" TCL_SIZE_MODIFIER
+ "d bytes) exceeded", TCL_SIZE_MAX));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL);
}
return NULL;
@@ -3510,7 +3508,8 @@ TclStringCat(
overflow:
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "max size for a Tcl value (%" TCL_SIZE_MODIFIER "d bytes) exceeded", TCL_SIZE_MAX));
+ "max size for a Tcl value (%" TCL_SIZE_MODIFIER
+ "d bytes) exceeded", TCL_SIZE_MAX));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL);
}
return NULL;
@@ -3534,9 +3533,9 @@ TclStringCat(
static int
UniCharNcasememcmp(
- const void *ucsPtr, /* Unicode string to compare to uct. */
- const void *uctPtr, /* Unicode string ucs is compared to. */
- size_t numChars) /* Number of Unichars to compare. */
+ const void *ucsPtr, /* Unicode string to compare to uct. */
+ const void *uctPtr, /* Unicode string ucs is compared to. */
+ size_t numChars) /* Number of Unichars to compare. */
{
const Tcl_UniChar *ucs = (const Tcl_UniChar *)ucsPtr;
const Tcl_UniChar *uct = (const Tcl_UniChar *)uctPtr;
@@ -3557,7 +3556,7 @@ static int
UtfNmemcmp(
const void *csPtr, /* UTF string to compare to ct. */
const void *ctPtr, /* UTF string cs is compared to. */
- size_t numChars) /* Number of UTF chars to compare. */
+ size_t numChars) /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1 = 0, ch2 = 0;
const char *cs = (const char *)csPtr;
@@ -3589,7 +3588,7 @@ static int
UtfNcasememcmp(
const void *csPtr, /* UTF string to compare to ct. */
const void *ctPtr, /* UTF string cs is compared to. */
- size_t numChars) /* Number of UTF chars to compare. */
+ size_t numChars) /* Number of UTF chars to compare. */
{
Tcl_UniChar ch1 = 0, ch2 = 0;
const char *cs = (const char *)csPtr;
@@ -3616,9 +3615,9 @@ UtfNcasememcmp(
static int
UniCharNmemcmp(
- const void *ucsPtr, /* Unicode string to compare to uct. */
- const void *uctPtr, /* Unicode string ucs is compared to. */
- size_t numChars) /* Number of unichars to compare. */
+ const void *ucsPtr, /* Unicode string to compare to uct. */
+ const void *uctPtr, /* Unicode string ucs is compared to. */
+ size_t numChars) /* Number of unichars to compare. */
{
const Tcl_UniChar *ucs = (const Tcl_UniChar *)ucsPtr;
const Tcl_UniChar *uct = (const Tcl_UniChar *)uctPtr;
@@ -3650,7 +3649,7 @@ TclStringCmp(
int checkEq, /* comparison is only for equality */
int nocase, /* comparison is not case sensitive */
Tcl_Size reqlength) /* requested length in characters;
- * TCL_INDEX_NONE to compare whole strings */
+ * TCL_INDEX_NONE to compare whole strings */
{
const char *s1, *s2;
int empty, match;
@@ -3696,9 +3695,8 @@ TclStringCmp(
&& (value1Ptr->bytes != NULL)
&& (s2len == value2Ptr->length)
&& (value2Ptr->bytes != NULL)) {
- /* each byte represents one character so s1l3n, s2l3n, and
- * reqlength are in both bytes and characters
- */
+ /* each byte represents one character so s1l3n, s2l3n,
+ * and reqlength are in both bytes and characters */
s1 = value1Ptr->bytes;
s2 = value2Ptr->bytes;
memCmpFn = memcmp;