r2593 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Tue Mar 11 12:25:28 CET 2008


Author: des
Date: 2008-03-11 12:25:28 +0100 (Tue, 11 Mar 2008)
New Revision: 2593

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c
Log:
Slightly more elegant version of the previous commit, which also fixed a
tiny braino.


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2008-03-11 11:10:19 UTC (rev 2592)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2008-03-11 11:25:28 UTC (rev 2593)
@@ -56,8 +56,8 @@
 static void
 vca_pollspace(unsigned fd)
 {
-	struct pollfd *newpollfd;
-	unsigned newnpoll;
+	struct pollfd *newpollfd = pollfd;
+	unsigned newnpoll = npoll;
 
 	if (fd < npoll)
 		return;
@@ -65,10 +65,10 @@
 	while (fd >= newnpoll)
 		newnpoll = newnpoll * 2 + 1;
 	VSL(SLT_Debug, 0, "Acceptor poll space increased to %u", newnpoll);
-	newpollfd = realloc(pollfd, newnpoll * sizeof *pollfd);
+	newpollfd = realloc(newpollfd, newnpoll * sizeof *newpollfd);
 	XXXAN(newpollfd);	/* close offending fd */
+	memset(newpollfd + npoll, 0, (newnpoll - npoll) * sizeof *newpollfd);
 	pollfd = newpollfd;
-	memset(pollfd + npoll, 0, (newnpoll - npoll) * sizeof *pollfd);
 	while (npoll < newnpoll)
 		pollfd[npoll++].fd = -1;
 }




More information about the varnish-commit mailing list