]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Optimize allocation a little.
authorRoy Marples <roy@marples.name>
Wed, 25 Feb 2009 07:51:25 +0000 (07:51 +0000)
committerRoy Marples <roy@marples.name>
Wed, 25 Feb 2009 07:51:25 +0000 (07:51 +0000)
eloop.c

diff --git a/eloop.c b/eloop.c
index d03641ca2ac5e7fa5ce5c55c413935ec7e8d2146..3e2b7a0384718b4154c8a4dd702a01b653d4444c 100644 (file)
--- a/eloop.c
+++ b/eloop.c
@@ -312,8 +312,9 @@ start_eloop(void)
                }
                if (nfds > fds_len) {
                        free(fds);
-                       fds = xmalloc(sizeof(*fds) * nfds);
-                       fds_len = nfds;
+                       /* Allocate 5 more than we need for future use */
+                       fds_len = nfds + 5;
+                       fds = xmalloc(sizeof(*fds) * fds_len);
                }
                nfds = 0;
                for (e = events; e; e = e->next) {