svn commit: trunk/uClibc/libc/inet
vapier at uclibc.org
vapier at uclibc.org
Fri Jan 6 04:08:02 UTC 2006
Author: vapier
Date: 2006-01-05 20:08:00 -0800 (Thu, 05 Jan 2006)
New Revision: 13123
Log:
rework the alloca() loop slightly to save some space
Modified:
trunk/uClibc/libc/inet/if_index.c
Changeset:
Modified: trunk/uClibc/libc/inet/if_index.c
===================================================================
--- trunk/uClibc/libc/inet/if_index.c 2006-01-06 03:28:21 UTC (rev 13122)
+++ trunk/uClibc/libc/inet/if_index.c 2006-01-06 04:08:00 UTC (rev 13123)
@@ -101,21 +101,19 @@
rq_len = RQ_IFS * sizeof (struct ifreq);
/* Read all the interfaces out of the kernel. */
- ifc.ifc_buf = alloca (rq_len);
- ifc.ifc_len = rq_len;
- while (1)
+ /* Note: alloca's in this loop are diff from glibc because it's smaller */
+ do
{
+ ifc.ifc_buf = extend_alloca (ifc.ifc_buf, rq_len, 2 * rq_len);
+ ifc.ifc_len = rq_len;
+
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
__close (fd);
return NULL;
}
- if (ifc.ifc_len < rq_len)
- break;
-
- ifc.ifc_buf = extend_alloca (ifc.ifc_buf, rq_len, 2 * rq_len);
- ifc.ifc_len = rq_len;
}
+ while (ifc.ifc_len == rq_len);
nifs = ifc.ifc_len / sizeof(struct ifreq);
More information about the uClibc-cvs
mailing list