Skip to content

Commit 1e9345e

Browse files
author
jan.nijtmans
committed
Backport some code cleanup from 8.7/9.0. Fix indenting
1 parent d121b99 commit 1e9345e

12 files changed

+404
-410
lines changed

unix/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ install-libraries: libraries
888888
@if [ -n "$(TCL_MODULE_PATH)" -a -f $(TOP_DIR)/library/tm.tcl ] ; then \
889889
echo "Customizing tcl module path"; \
890890
echo "if {![interp issafe]} { ::tcl::tm::roots [list $(TCL_MODULE_PATH)] }" >> \
891-
"$(SCRIPT_INSTALL_DIR)/tm.tcl"; \
891+
"$(SCRIPT_INSTALL_DIR)/tm.tcl"; \
892892
fi
893893

894894
install-tzdata:

unix/installManPage

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Suffix=""
1212

1313
while true; do
1414
case $1 in
15-
-s | --symlinks ) Sym="-s " ;;
16-
-z | --compress ) Gzip=$2; shift ;;
15+
-s | --symlinks ) Sym="-s " ;;
16+
-z | --compress ) Gzip=$2; shift ;;
1717
-e | --extension ) Gz=$2; shift ;;
1818
-x | --suffix ) Suffix=$2; shift ;;
1919
-*) cat <<EOF

unix/tclLoadDl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ FindSymbol(
199199
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
200200
"cannot find symbol \"%s\": %s", symbol, errorStr));
201201
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
202-
NULL);
202+
(char *)NULL);
203203
}
204204
}
205205
return proc;

unix/tclLoadDyld.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ FindSymbol(
410410
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
411411
"cannot find symbol \"%s\": %s", symbol, errMsg));
412412
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
413-
NULL);
413+
(char *)NULL);
414414
}
415415
return proc;
416416
}

unix/tclLoadNext.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ FindSymbol(
146146
if (proc == NULL && interp != NULL) {
147147
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
148148
"cannot find symbol \"%s\"", symbol));
149-
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, NULL);
149+
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, (char *)NULL);
150150
}
151151
return proc;
152152
}

unix/tclLoadOSF.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TclpDlopen(
124124
*/
125125

126126
if ((pkg = strrchr(fileName, '/')) == NULL) {
127-
pkg = fileName;
127+
pkg = fileName;
128128
} else {
129129
pkg++;
130130
}
@@ -164,7 +164,7 @@ FindSymbol(
164164
if (retval == NULL && interp != NULL) {
165165
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
166166
"cannot find symbol \"%s\"", symbol));
167-
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, NULL);
167+
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, (char *)NULL);
168168
}
169169
return retval;
170170
}

unix/tclUnixChan.c

+45-51
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ typedef struct TtyAttrs {
8383
int stop;
8484
} TtyAttrs;
8585

86-
#endif /* !SUPPORTS_TTY */
86+
#endif /* SUPPORTS_TTY */
8787

8888
#define UNSUPPORTED_OPTION(detail) \
8989
if (interp) { \
@@ -137,22 +137,22 @@ static int TtySetOptionProc(ClientData instanceData,
137137

138138
static const Tcl_ChannelType fileChannelType = {
139139
"file", /* Type name. */
140-
TCL_CHANNEL_VERSION_5, /* v5 channel */
141-
FileCloseProc, /* Close proc. */
142-
FileInputProc, /* Input proc. */
143-
FileOutputProc, /* Output proc. */
144-
FileSeekProc, /* Seek proc. */
140+
TCL_CHANNEL_VERSION_5,
141+
FileCloseProc,
142+
FileInputProc,
143+
FileOutputProc,
144+
FileSeekProc,
145145
NULL, /* Set option proc. */
146146
NULL, /* Get option proc. */
147-
FileWatchProc, /* Initialize notifier. */
148-
FileGetHandleProc, /* Get OS handles out of channel. */
149-
FileClose2Proc, /* close2proc. */
150-
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
151-
NULL, /* flush proc. */
152-
NULL, /* handler proc. */
153-
FileWideSeekProc, /* wide seek proc. */
154-
NULL,
155-
FileTruncateProc /* truncate proc. */
147+
FileWatchProc,
148+
FileGetHandleProc,
149+
FileClose2Proc,
150+
FileBlockModeProc,
151+
NULL, /* Flush proc. */
152+
NULL, /* Bubbled event handler proc. */
153+
FileWideSeekProc,
154+
NULL, /* Thread action proc. */
155+
FileTruncateProc
156156
};
157157

158158
#ifdef SUPPORTS_TTY
@@ -162,23 +162,23 @@ static const Tcl_ChannelType fileChannelType = {
162162
*/
163163

164164
static const Tcl_ChannelType ttyChannelType = {
165-
"tty", /* Type name. */
166-
TCL_CHANNEL_VERSION_5, /* v5 channel */
167-
FileCloseProc, /* Close proc. */
168-
FileInputProc, /* Input proc. */
169-
FileOutputProc, /* Output proc. */
165+
"tty",
166+
TCL_CHANNEL_VERSION_5,
167+
FileCloseProc,
168+
FileInputProc,
169+
FileOutputProc,
170+
NULL, /* Seek proc. */
171+
TtySetOptionProc,
172+
TtyGetOptionProc,
173+
FileWatchProc,
174+
FileGetHandleProc,
175+
FileClose2Proc,
176+
FileBlockModeProc,
177+
NULL, /* Flush proc. */
178+
NULL, /* Bubbled event handler proc. */
170179
NULL, /* Seek proc. */
171-
TtySetOptionProc, /* Set option proc. */
172-
TtyGetOptionProc, /* Get option proc. */
173-
FileWatchProc, /* Initialize notifier. */
174-
FileGetHandleProc, /* Get OS handles out of channel. */
175-
FileClose2Proc, /* close2proc. */
176-
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
177-
NULL, /* flush proc. */
178-
NULL, /* handler proc. */
179-
NULL, /* wide seek proc. */
180-
NULL, /* thread action proc. */
181-
NULL /* truncate proc. */
180+
NULL, /* Thread action proc. */
181+
NULL /* Truncate proc. */
182182
};
183183
#endif /* SUPPORTS_TTY */
184184

@@ -390,7 +390,7 @@ FileSeekProc(
390390
* one of SEEK_START, SEEK_SET or SEEK_END. */
391391
int *errorCodePtr) /* To store error code. */
392392
{
393-
FileState *fsPtr = instanceData;
393+
FileState *fsPtr = (FileState *)instanceData;
394394
Tcl_WideInt oldLoc, newLoc;
395395

396396
/*
@@ -871,11 +871,11 @@ TtyGetOptionProc(
871871
tcgetattr(fsPtr->fd, &iostate);
872872
Tcl_DStringInit(&ds);
873873

874-
Tcl_ExternalToUtfDString(NULL, (char *) &iostate.c_cc[VSTART], 1, &ds);
874+
Tcl_ExternalToUtfDString(NULL, (char *)&iostate.c_cc[VSTART], 1, &ds);
875875
Tcl_DStringAppendElement(dsPtr, Tcl_DStringValue(&ds));
876876
TclDStringClear(&ds);
877877

878-
Tcl_ExternalToUtfDString(NULL, (char *) &iostate.c_cc[VSTOP], 1, &ds);
878+
Tcl_ExternalToUtfDString(NULL, (char *)&iostate.c_cc[VSTOP], 1, &ds);
879879
Tcl_DStringAppendElement(dsPtr, Tcl_DStringValue(&ds));
880880
Tcl_DStringFree(&ds);
881881
}
@@ -1284,22 +1284,18 @@ TtyParseMode(
12841284
* not allow preprocessor directives in their arguments.
12851285
*/
12861286

1287-
if (
1288-
#if defined(PAREXT)
1289-
strchr("noems", parity)
1287+
#ifdef PAREXT
1288+
#define PARITY_CHARS "noems"
1289+
#define PARITY_MSG "n, o, e, m, or s"
12901290
#else
1291-
strchr("noe", parity)
1291+
#define PARITY_CHARS "noe"
1292+
#define PARITY_MSG "n, o, or e"
12921293
#endif /* PAREXT */
1293-
== NULL) {
1294+
1295+
if (strchr(PARITY_CHARS, parity) == NULL) {
12941296
if (interp != NULL) {
12951297
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
1296-
"%s parity: should be %s", bad,
1297-
#if defined(PAREXT)
1298-
"n, o, e, m, or s"
1299-
#else
1300-
"n, o, or e"
1301-
#endif /* PAREXT */
1302-
));
1298+
"%s parity: should be %s", bad, PARITY_MSG));
13031299
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL);
13041300
}
13051301
return TCL_ERROR;
@@ -1598,12 +1594,11 @@ TclpGetDefaultStdChannel(
15981594
* Some #def's to make the code a little clearer!
15991595
*/
16001596

1601-
#define ZERO_OFFSET ((Tcl_SeekOffset) 0)
16021597
#define ERROR_OFFSET ((Tcl_SeekOffset) -1)
16031598

16041599
switch (type) {
16051600
case TCL_STDIN:
1606-
if ((TclOSseek(0, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
1601+
if ((TclOSseek(0, 0, SEEK_CUR) == ERROR_OFFSET)
16071602
&& (errno == EBADF)) {
16081603
return NULL;
16091604
}
@@ -1612,7 +1607,7 @@ TclpGetDefaultStdChannel(
16121607
bufMode = "line";
16131608
break;
16141609
case TCL_STDOUT:
1615-
if ((TclOSseek(1, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
1610+
if ((TclOSseek(1, 0, SEEK_CUR) == ERROR_OFFSET)
16161611
&& (errno == EBADF)) {
16171612
return NULL;
16181613
}
@@ -1621,7 +1616,7 @@ TclpGetDefaultStdChannel(
16211616
bufMode = "line";
16221617
break;
16231618
case TCL_STDERR:
1624-
if ((TclOSseek(2, ZERO_OFFSET, SEEK_CUR) == ERROR_OFFSET)
1619+
if ((TclOSseek(2, 0, SEEK_CUR) == ERROR_OFFSET)
16251620
&& (errno == EBADF)) {
16261621
return NULL;
16271622
}
@@ -1634,7 +1629,6 @@ TclpGetDefaultStdChannel(
16341629
break;
16351630
}
16361631

1637-
#undef ZERO_OFFSET
16381632
#undef ERROR_OFFSET
16391633

16401634
channel = Tcl_MakeFileChannel(INT2PTR(fd), mode);

unix/tclUnixCompat.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -999,17 +999,17 @@ TclWinCPUID(
999999
#if defined(HAVE_CPUID)
10001000
#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
10011001
__asm__ __volatile__("movq %%rbx, %%rsi \n\t" /* save %rbx */
1002-
"cpuid \n\t"
1003-
"xchgq %%rsi, %%rbx \n\t" /* restore the old %rbx */
1004-
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
1005-
: "a"(index));
1002+
"cpuid \n\t"
1003+
"xchgq %%rsi, %%rbx \n\t" /* restore the old %rbx */
1004+
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
1005+
: "a"(index));
10061006
status = TCL_OK;
10071007
#elif defined(__i386__) || defined(_M_IX86)
10081008
__asm__ __volatile__("mov %%ebx, %%esi \n\t" /* save %ebx */
1009-
"cpuid \n\t"
1010-
"xchg %%esi, %%ebx \n\t" /* restore the old %ebx */
1011-
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
1012-
: "a"(index));
1009+
"cpuid \n\t"
1010+
"xchg %%esi, %%ebx \n\t" /* restore the old %ebx */
1011+
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
1012+
: "a"(index));
10131013
status = TCL_OK;
10141014
#endif
10151015
#endif

0 commit comments

Comments
 (0)