From 6f35cbe15db6feb1c5b107376f4ce7de23915f8b Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Wed, 10 Nov 2004 19:33:44 +0000 Subject: * unix/tclUnixChan.c: [Bug 727786]. Exterminated the code marked DEPRECATED. This code has not been used in over a year now, and we have no complaints. --- ChangeLog | 6 +++ unix/tclUnixChan.c | 108 ++--------------------------------------------------- 2 files changed, 10 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ea32e9..f07660b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-11-10 Andreas Kupries + + * unix/tclUnixChan.c: [Bug 727786]. Exterminated the code marked + DEPRECATED. This code has not been used in over a year now, and + we have no complaints. + 2004-11-08 David Gravereaux * win/tclWinPipe.c: The pipe channel driver now respects diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 4d5b838..700b203 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * 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.51 2004/10/06 13:55:40 dkf Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.52 2004/11/10 19:33:52 andreas_kupries Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -126,10 +126,6 @@ typedef struct FileState { int validMask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, or TCL_EXCEPTION: indicates * which operations are valid on the file. */ -#ifdef DEPRECATED - struct FileState *nextPtr; /* Pointer to next file in list of all - * file channels. */ -#endif /* DEPRECATED */ } FileState; #ifdef SUPPORTS_TTY @@ -168,19 +164,6 @@ typedef struct TtyAttrs { " not supported for this platform", (char *) NULL); \ } -#ifdef DEPRECATED -typedef struct ThreadSpecificData { - /* - * List of all file channels currently open. This is per thread and is - * used to match up fd's to channels, which rarely occurs. - */ - - FileState *firstFilePtr; -} ThreadSpecificData; - -static Tcl_ThreadDataKey dataKey; -#endif /* DEPRECATED */ - /* * This structure describes per-instance state of a tcp based channel. */ @@ -547,10 +530,7 @@ FileCloseProc(instanceData, interp) { FileState *fsPtr = (FileState *) instanceData; int errorCode = 0; -#ifdef DEPRECATED - FileState **nextPtrPtr; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); -#endif /* DEPRECATED */ + Tcl_DeleteFileHandler(fsPtr->fd); /* @@ -1771,9 +1751,6 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions) #ifdef SUPPORTS_TTY int ctl_tty; #endif /* SUPPORTS_TTY */ -#ifdef DEPRECATED - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); -#endif /* DEPRECATED */ switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { case O_RDONLY: @@ -1844,12 +1821,6 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions) fsPtr = (FileState *) ckalloc((unsigned) sizeof(FileState)); } -#ifdef DEPRECATED - if (channelTypePtr == &fileChannelType) { - fsPtr->nextPtr = tsdPtr->firstFilePtr; - tsdPtr->firstFilePtr = fsPtr; - } -#endif /* DEPRECATED */ fsPtr->validMask = channelPermissions | TCL_EXCEPTION; fsPtr->fd = fd; @@ -1901,9 +1872,6 @@ Tcl_MakeFileChannel(handle, mode) char channelName[16 + TCL_INTEGER_SPACE]; int fd = (int) handle; Tcl_ChannelType *channelTypePtr; -#ifdef DEPRECATED - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); -#endif /* DEPRECATED */ struct sockaddr sockaddr; socklen_t sockaddrLen = sizeof(sockaddr); @@ -1911,21 +1879,6 @@ Tcl_MakeFileChannel(handle, mode) return NULL; } - - /* - * Look to see if a channel with this fd and the same mode already exists. - * If the fd is used, but the mode doesn't match, return NULL. - */ - -#ifdef DEPRECATED - for (fsPtr = tsdPtr->firstFilePtr; fsPtr != NULL; fsPtr = fsPtr->nextPtr) { - if (fsPtr->fd == fd) { - return ((mode|TCL_EXCEPTION) == fsPtr->validMask) ? - fsPtr->channel : NULL; - } - } -#endif /* DEPRECATED */ - sockaddr.sa_family = AF_UNSPEC; #ifdef SUPPORTS_TTY @@ -1945,12 +1898,6 @@ Tcl_MakeFileChannel(handle, mode) sprintf(channelName, "file%d", fd); } -#ifdef DEPRECATED - if (channelTypePtr == &fileChannelType) { - fsPtr->nextPtr = tsdPtr->firstFilePtr; - tsdPtr->firstFilePtr = fsPtr; - } -#endif /* DEPRECATED */ fsPtr->fd = fd; fsPtr->validMask = mode | TCL_EXCEPTION; fsPtr->channel = Tcl_CreateChannel(channelTypePtr, channelName, @@ -3304,7 +3251,7 @@ TclUnixWaitForFile(fd, mask, timeout) * None. * * Side effects: - * Changes thread local list of valid channels. + * None. This is a no-op under unix. * *---------------------------------------------------------------------- */ @@ -3315,39 +3262,6 @@ TclpCutFileChannel(chan) * not be referenced in any * interpreter. */ { -#ifdef DEPRECATED - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - Channel *chanPtr = (Channel *) chan; - FileState *fsPtr; - FileState **nextPtrPtr; - int removed = 0; - - if (chanPtr->typePtr != &fileChannelType) { - return; - } - - fsPtr = (FileState *) chanPtr->instanceData; - - for (nextPtrPtr = &(tsdPtr->firstFilePtr); (*nextPtrPtr) != NULL; - nextPtrPtr = &((*nextPtrPtr)->nextPtr)) { - if ((*nextPtrPtr) == fsPtr) { - (*nextPtrPtr) = fsPtr->nextPtr; - removed = 1; - break; - } - } - - /* - * This could happen if the channel was created in one thread - * and then moved to another without updating the thread - * local data in each thread. - */ - - if (!removed) { - Tcl_Panic("file info ptr not on thread channel list"); - } - -#endif /* DEPRECATED */ } /* @@ -3362,7 +3276,7 @@ TclpCutFileChannel(chan) * None. * * Side effects: - * Changes thread local list of valid channels. + * None. This is a no-op under unix. * *---------------------------------------------------------------------- */ @@ -3373,18 +3287,4 @@ TclpSpliceFileChannel(chan) * not be referenced in any * interpreter. */ { -#ifdef DEPRECATED - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - Channel *chanPtr = (Channel *) chan; - FileState *fsPtr; - - if (chanPtr->typePtr != &fileChannelType) { - return; - } - - fsPtr = (FileState *) chanPtr->instanceData; - - fsPtr->nextPtr = tsdPtr->firstFilePtr; - tsdPtr->firstFilePtr = fsPtr; -#endif /* DEPRECATED */ } -- cgit v0.12