diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | unix/tclLoadDl.c | 10 | ||||
-rw-r--r-- | unix/tclLoadNext.c | 8 | ||||
-rw-r--r-- | unix/tclUnixChan.c | 16 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 8 | ||||
-rw-r--r-- | unix/tclUnixNotfy.c | 11 | ||||
-rw-r--r-- | unix/tclUnixSock.c | 18 | ||||
-rw-r--r-- | unix/tclUnixTest.c | 47 | ||||
-rw-r--r-- | unix/tclXtTest.c | 14 |
9 files changed, 73 insertions, 70 deletions
@@ -1,3 +1,14 @@ +2010-06-21 Jan Nijtmans <nijtmans@users.sf.net> + + * unix/tclLoadDl.c Eliminate various unnecessary type casts, use + * unix/tclLoadNext.c function typedefs whenever possible + * unix/tclUnixChan.c + * unix/tclUnixFile.c + * unix/tclUnixNotfy.c + * unix/tclUnixSock.c + * unix/tclUnixTest.c + * unix/tclXtTest.c + 2010-06-18 Donal K. Fellows <dkf@users.sf.net> * library/init.tcl (auto_execok): [Bug 3017997]: Add .cmd to the diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index b0bff77..7bec84c 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -6,10 +6,10 @@ * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadDl.c,v 1.23 2010/04/26 22:30:05 kennykb Exp $ + * RCS: @(#) $Id: tclLoadDl.c,v 1.24 2010/06/21 11:23:23 nijtmans Exp $ */ #include "tclInt.h" @@ -93,7 +93,7 @@ TclpDlopen( */ Tcl_DString ds; - char *fileName = Tcl_GetString(pathPtr); + const char *fileName = Tcl_GetString(pathPtr); native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds); handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL); @@ -113,7 +113,7 @@ TclpDlopen( return TCL_ERROR; } newHandle = (Tcl_LoadHandle) ckalloc(sizeof(*newHandle)); - newHandle->clientData = (ClientData) handle; + newHandle->clientData = handle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; *unloadProcPtr = &UnloadFile; diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c index 35aeba4..88b1568 100644 --- a/unix/tclLoadNext.c +++ b/unix/tclLoadNext.c @@ -6,10 +6,10 @@ * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadNext.c,v 1.17 2010/04/02 21:21:06 kennykb Exp $ + * RCS: @(#) $Id: tclLoadNext.c,v 1.18 2010/06/21 11:23:23 nijtmans Exp $ */ #include "tclInt.h" @@ -104,7 +104,7 @@ TclpDlopen( NXCloseMemory(errorStream, NX_FREEBUFFER); newHandle = (Tcl_LoadHandle) ckalloc(sizeof(*newHandle)); - newHandle->clientData = (ClientData) 1; + newHandle->clientData = INT2PTR(1); newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; *loadHandle = newHandle; diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 9b6cc95..5609a15 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -7,10 +7,10 @@ * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.105 2010/01/13 06:46:57 nijtmans Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.106 2010/06/21 11:23:23 nijtmans Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -1618,7 +1618,7 @@ TclpOpenFileChannel( fsPtr->fd = fd; fsPtr->channel = Tcl_CreateChannel(channelTypePtr, channelName, - (ClientData) fsPtr, channelPermissions); + fsPtr, channelPermissions); if (translation != NULL) { /* @@ -1683,7 +1683,7 @@ Tcl_MakeFileChannel( #endif /* SUPPORTS_TTY */ if ((getsockname(fd, &sockaddr, &sockaddrLen) == 0) && (sockaddrLen > 0) && (sockaddr.sa_family == AF_INET)) { - return TclpMakeTcpClientChannelMode((ClientData) INT2PTR(fd), mode); + return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); } else { channelTypePtr = &fileChannelType; fsPtr = (FileState *) ckalloc((unsigned) sizeof(FileState)); @@ -1693,7 +1693,7 @@ Tcl_MakeFileChannel( fsPtr->fd = fd; fsPtr->validMask = mode | TCL_EXCEPTION; fsPtr->channel = Tcl_CreateChannel(channelTypePtr, channelName, - (ClientData) fsPtr, mode); + fsPtr, mode); return fsPtr->channel; } @@ -1767,7 +1767,7 @@ TclpGetDefaultStdChannel( #undef ZERO_OFFSET #undef ERROR_OFFSET - channel = Tcl_MakeFileChannel((ClientData) INT2PTR(fd), mode); + channel = Tcl_MakeFileChannel(INT2PTR(fd), mode); if (channel == NULL) { return NULL; } @@ -1827,7 +1827,7 @@ Tcl_GetOpenFile( FILE *f; chan = Tcl_GetChannel(interp, chanID, &chanMode); - if (chan == (Tcl_Channel) NULL) { + if (chan == NULL) { return TCL_ERROR; } if ((forWriting) && ((chanMode & TCL_WRITABLE) == 0)) { diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index d6cf239..1ab92f3 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -6,10 +6,10 @@ * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFile.c,v 1.57 2010/04/22 11:40:32 nijtmans Exp $ + * RCS: @(#) $Id: tclUnixFile.c,v 1.58 2010/06/21 11:23:23 nijtmans Exp $ */ #include "tclInt.h" @@ -710,7 +710,7 @@ TclpGetNativeCwd( char *newCd = ckalloc((unsigned) strlen(buffer) + 1); strcpy(newCd, buffer); - return (ClientData) newCd; + return newCd; } /* diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index e8860df..79bcf9c 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -7,10 +7,10 @@ * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixNotfy.c,v 1.41 2009/12/17 00:06:21 nijtmans Exp $ + * RCS: @(#) $Id: tclUnixNotfy.c,v 1.42 2010/06/21 11:23:23 nijtmans Exp $ */ #include "tclInt.h" @@ -232,7 +232,7 @@ Tcl_InitNotifier(void) Tcl_MutexUnlock(¬ifierMutex); #endif - return (ClientData) tsdPtr; + return tsdPtr; } } @@ -344,7 +344,8 @@ Tcl_AlertNotifier( return; } else { #ifdef TCL_THREADS - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData; + ThreadSpecificData *tsdPtr = clientData; + Tcl_MutexLock(¬ifierMutex); tsdPtr->eventReady = 1; Tcl_ConditionNotify(&tsdPtr->waitCV); diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 97217ba..f5b9be4 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -5,10 +5,10 @@ * * Copyright (c) 1995 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixSock.c,v 1.25 2010/03/01 15:00:45 dkf Exp $ + * RCS: @(#) $Id: tclUnixSock.c,v 1.26 2010/06/21 11:23:23 nijtmans Exp $ */ #include "tclInt.h" @@ -799,7 +799,7 @@ TcpGetHandleProc( { TcpState *statePtr = (TcpState *) instanceData; - *handlePtr = (ClientData) INT2PTR(statePtr->fd); + *handlePtr = INT2PTR(statePtr->fd); return TCL_OK; } @@ -1143,7 +1143,7 @@ Tcl_OpenTcpClient( sprintf(channelName, "sock%d", statePtr->fd); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, - (ClientData) statePtr, (TCL_READABLE | TCL_WRITABLE)); + statePtr, (TCL_READABLE | TCL_WRITABLE)); if (Tcl_SetChannelOption(interp, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -1210,7 +1210,7 @@ TclpMakeTcpClientChannelMode( sprintf(channelName, "sock%d", statePtr->fd); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, - (ClientData) statePtr, mode); + statePtr, mode); if (Tcl_SetChannelOption(NULL, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -1267,10 +1267,10 @@ Tcl_OpenTcpServer( */ Tcl_CreateFileHandler(statePtr->fd, TCL_READABLE, TcpAccept, - (ClientData) statePtr); + statePtr); sprintf(channelName, "sock%d", statePtr->fd); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, - (ClientData) statePtr, 0); + statePtr, 0); return statePtr->channel; } @@ -1327,7 +1327,7 @@ TcpAccept( sprintf(channelName, "sock%d", newsock); newSockState->channel = Tcl_CreateChannel(&tcpChannelType, channelName, - (ClientData) newSockState, (TCL_READABLE | TCL_WRITABLE)); + newSockState, (TCL_READABLE | TCL_WRITABLE)); Tcl_SetChannelOption(NULL, newSockState->channel, "-translation", "auto crlf"); diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index e36e4a7..f51cf2e 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -6,10 +6,10 @@ * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixTest.c,v 1.33 2010/02/25 22:20:10 nijtmans Exp $ + * RCS: @(#) $Id: tclUnixTest.c,v 1.34 2010/06/21 11:23:23 nijtmans Exp $ */ #ifndef USE_TCL_STUBS @@ -64,26 +64,17 @@ static const char *gotsig = "0"; * Forward declarations of functions defined later in this file: */ -static void TestFileHandlerProc(ClientData clientData, int mask); -static int TestfilehandlerCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestfilewaitCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestfindexecutableCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgetopenfileCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgetdefencdirCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestsetdefencdirCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestalarmCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgotsigCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); -static void AlarmHandler(int signum); -static int TestchmodCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); +static Tcl_CmdProc TestalarmCmd; +static Tcl_CmdProc TestchmodCmd; +static Tcl_CmdProc TestfilehandlerCmd; +static Tcl_CmdProc TestfilewaitCmd; +static Tcl_CmdProc TestfindexecutableCmd; +static Tcl_CmdProc TestgetdefencdirCmd; +static Tcl_CmdProc TestgetopenfileCmd; +static Tcl_CmdProc TestgotsigCmd; +static Tcl_CmdProc TestsetdefencdirCmd; +static Tcl_FileProc TestFileHandlerProc; +static void AlarmHandler(int signum); /* *---------------------------------------------------------------------- @@ -238,24 +229,24 @@ TestfilehandlerCmd( if (strcmp(argv[3], "readable") == 0) { Tcl_CreateFileHandler(GetFd(pipePtr->readFile), TCL_READABLE, - TestFileHandlerProc, (ClientData) pipePtr); + TestFileHandlerProc, pipePtr); } else if (strcmp(argv[3], "off") == 0) { Tcl_DeleteFileHandler(GetFd(pipePtr->readFile)); } else if (strcmp(argv[3], "disabled") == 0) { Tcl_CreateFileHandler(GetFd(pipePtr->readFile), 0, - TestFileHandlerProc, (ClientData) pipePtr); + TestFileHandlerProc, pipePtr); } else { Tcl_AppendResult(interp, "bad read mode \"", argv[3], "\"", NULL); return TCL_ERROR; } if (strcmp(argv[4], "writable") == 0) { Tcl_CreateFileHandler(GetFd(pipePtr->writeFile), TCL_WRITABLE, - TestFileHandlerProc, (ClientData) pipePtr); + TestFileHandlerProc, pipePtr); } else if (strcmp(argv[4], "off") == 0) { Tcl_DeleteFileHandler(GetFd(pipePtr->writeFile)); } else if (strcmp(argv[4], "disabled") == 0) { Tcl_CreateFileHandler(GetFd(pipePtr->writeFile), 0, - TestFileHandlerProc, (ClientData) pipePtr); + TestFileHandlerProc, pipePtr); } else { Tcl_AppendResult(interp, "bad read mode \"", argv[4], "\"", NULL); return TCL_ERROR; @@ -339,7 +330,7 @@ TestFileHandlerProc( int mask) /* Indicates which events happened: * TCL_READABLE or TCL_WRITABLE. */ { - Pipe *pipePtr = (Pipe *) clientData; + Pipe *pipePtr = clientData; if (mask & TCL_READABLE) { pipePtr->readCount++; diff --git a/unix/tclXtTest.c b/unix/tclXtTest.c index 54bcbcf..d921074 100644 --- a/unix/tclXtTest.c +++ b/unix/tclXtTest.c @@ -5,10 +5,10 @@ * * Copyright (c) 1997 by Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclXtTest.c,v 1.11 2010/06/14 12:58:11 nijtmans Exp $ + * RCS: @(#) $Id: tclXtTest.c,v 1.12 2010/06/21 11:23:23 nijtmans Exp $ */ #ifndef USE_TCL_STUBS @@ -17,9 +17,9 @@ #include <X11/Intrinsic.h> #include "tcl.h" -static int TesteventloopCmd(ClientData clientData, - Tcl_Interp *interp, int argc, const char **argv); +static Tcl_CmdProc TesteventloopCmd; extern DLLEXPORT Tcl_PackageInitProc Tclxttest_Init; + /* * Functions defined in tclXtNotify.c for use by users of the Xt Notifier: */ @@ -89,10 +89,10 @@ TesteventloopCmd( * innermost invocation of the "wait" * subcommand. */ - if (argc < 2) { + if (argc < 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], " option ... \"", NULL); - return TCL_ERROR; + return TCL_ERROR; } if (strcmp(argv[1], "done") == 0) { *framePtr = 1; |