Tcl Source Code

Artifact [c7a71341d2]
Login

Artifact c7a71341d222b28763831110bd5ef4fb8b7fe746:

Attachment "727786.patch" to ticket [727786ffff] added by andreas_kupries 2004-10-29 03:23:28.
Index: unix/tclUnixChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixChan.c,v
retrieving revision 1.51
diff -u -r1.51 tclUnixChan.c
--- unix/tclUnixChan.c	6 Oct 2004 13:55:40 -0000	1.51
+++ unix/tclUnixChan.c	28 Oct 2004 20:21:24 -0000
@@ -126,10 +126,6 @@
     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 @@
 		    " 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 @@
 {
     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 @@
 #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 @@
 	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 @@
     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 @@
 	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 @@
 	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 @@
  *	None.
  *
  * Side effects:
- *	Changes thread local list of valid channels.
+ *	None. This is a no-op under unix.
  *
  *----------------------------------------------------------------------
  */
@@ -3315,39 +3262,6 @@
                                          * 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 @@
  *	None.
  *
  * Side effects:
- *	Changes thread local list of valid channels.
+ *	None. This is a no-op under unix.
  *
  *----------------------------------------------------------------------
  */
@@ -3373,18 +3287,4 @@
                                          * 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 */
 }