Index: trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlayer.c
===================================================================
--- trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlayer.c	(revision 101877)
+++ trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlayer.c	(revision 101884)
@@ -49,5 +49,4 @@
 
 #include <string.h> /* for memset() */
-static PRStatus _PR_DestroyIOLayer(PRFileDesc *stack);
 
 void PR_CALLBACK pl_FDDestructor(PRFileDesc *fd)
@@ -59,310 +58,4 @@
 }
 
-/*
-** Default methods that just call down to the next fd.
-*/
-static PRStatus PR_CALLBACK pl_TopClose (PRFileDesc *fd)
-{
-    PRFileDesc *top, *lower;
-	PRStatus rv;
-
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-    PR_ASSERT(fd->secret == NULL);
-    PR_ASSERT(fd->methods->file_type == PR_DESC_LAYERED);
-
-	if (PR_IO_LAYER_HEAD == fd->identity) {
-		/*
-		 * new style stack; close all the layers, before deleting the
-		 * stack head
-		 */
-		rv = fd->lower->methods->close(fd->lower);
-		_PR_DestroyIOLayer(fd);
-		return rv;
-	} else if ((fd->higher) && (PR_IO_LAYER_HEAD == fd->higher->identity)) {
-		/*
-		 * lower layers of new style stack
-		 */
-		lower = fd->lower;
-		/*
-		 * pop and cleanup current layer
-		 */
-    	top = PR_PopIOLayer(fd->higher, PR_TOP_IO_LAYER);
-		top->dtor(top);
-		/*
-		 * then call lower layer
-		 */
-		return (lower->methods->close(lower));
-	} else {
-		/* old style stack */
-    	top = PR_PopIOLayer(fd, PR_TOP_IO_LAYER);
-		top->dtor(top);
-		return (fd->methods->close)(fd);
-	}
-}
-
-static PRInt32 PR_CALLBACK pl_DefRead (PRFileDesc *fd, void *buf, PRInt32 amount)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->read)(fd->lower, buf, amount);
-}
-
-static PRInt32 PR_CALLBACK pl_DefWrite (
-    PRFileDesc *fd, const void *buf, PRInt32 amount)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->write)(fd->lower, buf, amount);
-}
-
-static PRInt32 PR_CALLBACK pl_DefAvailable (PRFileDesc *fd)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->available)(fd->lower);
-}
-
-static PRStatus PR_CALLBACK pl_DefFsync (PRFileDesc *fd)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->fsync)(fd->lower);
-}
-
-static PRInt32 PR_CALLBACK pl_DefSeek (
-    PRFileDesc *fd, PRInt32 offset, PRSeekWhence how)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->seek)(fd->lower, offset, how);
-}
-
-static PRInt64 PR_CALLBACK pl_DefSeek64 (
-    PRFileDesc *fd, PRInt64 offset, PRSeekWhence how)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->seek64)(fd->lower, offset, how);
-}
-
-static PRStatus PR_CALLBACK pl_DefFileInfo (PRFileDesc *fd, PRFileInfo *info)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->fileInfo)(fd->lower, info);
-}
-
-static PRStatus PR_CALLBACK pl_DefFileInfo64 (PRFileDesc *fd, PRFileInfo64 *info)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->fileInfo64)(fd->lower, info);
-}
-
-static PRInt32 PR_CALLBACK pl_DefWritev (PRFileDesc *fd, const PRIOVec *iov,
-    PRInt32 size, PRIntervalTime timeout)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->writev)(fd->lower, iov, size, timeout);
-}
-
-static PRStatus PR_CALLBACK pl_DefConnect (
-    PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->connect)(fd->lower, addr, timeout);
-}
-
-static PRStatus PR_CALLBACK pl_DefConnectcontinue (
-    PRFileDesc *fd, PRInt16 out_flags)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->connectcontinue)(fd->lower, out_flags);
-}
-
-static PRFileDesc* PR_CALLBACK pl_TopAccept (
-    PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout)
-{
-    PRStatus rv;
-    PRFileDesc *newfd, *layer = fd;
-    PRFileDesc *newstack;
-	PRBool newstyle_stack = PR_FALSE;
-
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-	/* test for new style stack */
-	while (NULL != layer->higher)
-		layer = layer->higher;
-	newstyle_stack = (PR_IO_LAYER_HEAD == layer->identity) ? PR_TRUE : PR_FALSE;
-    newstack = PR_NEW(PRFileDesc);
-    if (NULL == newstack)
-    {
-        PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
-        return NULL;
-    }
-    *newstack = *fd;  /* make a copy of the accepting layer */
-
-    newfd = (fd->lower->methods->accept)(fd->lower, addr, timeout);
-    if (NULL == newfd)
-    {
-        PR_DELETE(newstack);
-        return NULL;
-    }
-
-    if (newstyle_stack) {
-		newstack->lower = newfd;
-		newfd->higher = newstack;
-		return newstack;
-	} else {
-		/* this PR_PushIOLayer call cannot fail */
-		rv = PR_PushIOLayer(newfd, PR_TOP_IO_LAYER, newstack);
-		PR_ASSERT(PR_SUCCESS == rv);
-    	return newfd;  /* that's it */
-	}
-}
-
-static PRStatus PR_CALLBACK pl_DefBind (PRFileDesc *fd, const PRNetAddr *addr)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->bind)(fd->lower, addr);
-}
-
-static PRStatus PR_CALLBACK pl_DefListen (PRFileDesc *fd, PRIntn backlog)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->listen)(fd->lower, backlog);
-}
-
-static PRStatus PR_CALLBACK pl_DefShutdown (PRFileDesc *fd, PRIntn how)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->shutdown)(fd->lower, how);
-}
-
-static PRInt32 PR_CALLBACK pl_DefRecv (
-    PRFileDesc *fd, void *buf, PRInt32 amount,
-    PRIntn flags, PRIntervalTime timeout)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->recv)(
-        fd->lower, buf, amount, flags, timeout);
-}
-
-static PRInt32 PR_CALLBACK pl_DefSend (
-    PRFileDesc *fd, const void *buf,
-    PRInt32 amount, PRIntn flags, PRIntervalTime timeout)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->send)(fd->lower, buf, amount, flags, timeout);
-}
-
-static PRInt16 PR_CALLBACK pl_DefPoll (
-    PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->poll)(fd->lower, in_flags, out_flags);
-}
-
-static PRStatus PR_CALLBACK pl_DefGetsockname (PRFileDesc *fd, PRNetAddr *addr)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->getsockname)(fd->lower, addr);
-}
-
-static PRStatus PR_CALLBACK pl_DefGetpeername (PRFileDesc *fd, PRNetAddr *addr)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->getpeername)(fd->lower, addr);
-}
-
-static PRStatus PR_CALLBACK pl_DefGetsocketoption (
-    PRFileDesc *fd, PRSocketOptionData *data)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->getsocketoption)(fd->lower, data);
-}
-
-static PRStatus PR_CALLBACK pl_DefSetsocketoption (
-    PRFileDesc *fd, const PRSocketOptionData *data)
-{
-    PR_ASSERT(fd != NULL);
-    PR_ASSERT(fd->lower != NULL);
-
-    return (fd->lower->methods->setsocketoption)(fd->lower, data);
-}
-
-/* Methods for the top of the stack.  Just call down to the next fd. */
-static PRIOMethods pl_methods = {
-    PR_DESC_LAYERED,
-    pl_TopClose,
-    pl_DefRead,
-    pl_DefWrite,
-    pl_DefAvailable,
-    pl_DefFsync,
-    pl_DefSeek,
-    pl_DefSeek64,
-    pl_DefFileInfo,
-    pl_DefFileInfo64,
-    pl_DefWritev,
-    pl_DefConnect,
-    pl_TopAccept,
-    pl_DefBind,
-    pl_DefListen,
-    pl_DefShutdown,
-    pl_DefRecv,
-    pl_DefSend,
-    pl_DefPoll,
-    pl_DefGetsockname,
-    pl_DefGetpeername,
-    (PRReservedFN)_PR_InvalidInt,
-    (PRReservedFN)_PR_InvalidInt,
-    pl_DefGetsocketoption,
-    pl_DefSetsocketoption,
-    pl_DefConnectcontinue,
-    (PRReservedFN)_PR_InvalidInt,
-    (PRReservedFN)_PR_InvalidInt,
-    (PRReservedFN)_PR_InvalidInt,
-    (PRReservedFN)_PR_InvalidInt
-};
-
-PR_IMPLEMENT(const PRIOMethods*) PR_GetDefaultIOMethods(void)
-{
-    return &pl_methods;
-}  /* PR_GetDefaultIOMethods */
-
 PR_IMPLEMENT(PRFileDesc*) PR_CreateIOLayerStub(
     PRDescIdentity ident, const PRIOMethods *methods)
@@ -386,32 +79,4 @@
     return fd;
 }  /* PR_CreateIOLayerStub */
-
-/*
- * PR_CreateIOLayer
- *		Create a new style stack, where the stack top is a dummy header.
- *		Unlike the old style stacks, the contents of the stack head
- *		are not modified when a layer is pushed onto or popped from a new
- *		style stack.
- */
-
-PR_IMPLEMENT(PRFileDesc*) PR_CreateIOLayer(PRFileDesc *top)
-{
-    PRFileDesc *fd = NULL;
-
-	fd = PR_NEWZAP(PRFileDesc);
-	if (NULL == fd)
-		PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
-	else
-	{
-		fd->methods = &pl_methods;
-		fd->dtor = pl_FDDestructor;
-		fd->identity = PR_IO_LAYER_HEAD;
-		fd->higher = NULL;
-		fd->lower = top;
-		top->higher = fd;
-		top->lower = NULL;
-	}
-    return fd;
-}  /* PR_CreateIOLayer */
 
 /*
