svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Thu Nov 30 21:11:02 UTC 2006


Author: vda
Date: 2006-11-30 13:11:01 -0800 (Thu, 30 Nov 2006)
New Revision: 16742

Log:
"make bigdata" biggest offender dealt with:
xmalloc 16Kb buffer instead of keeping it in bss


Modified:
   trunk/busybox/util-linux/fdisk_osf.c
   trunk/busybox/util-linux/mkfs_minix.c


Changeset:
Modified: trunk/busybox/util-linux/fdisk_osf.c
===================================================================
--- trunk/busybox/util-linux/fdisk_osf.c	2006-11-30 20:57:50 UTC (rev 16741)
+++ trunk/busybox/util-linux/fdisk_osf.c	2006-11-30 21:11:01 UTC (rev 16742)
@@ -735,7 +735,7 @@
 	memset(d, 0, sizeof(struct xbsd_disklabel));
 
 	snprintf(path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
-	if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
+	if (!xbsd_get_bootstrap(path, &disklabelbuffer[xbsd_dlabel.d_secsize],
 			  (int) xbsd_dlabel.d_bbsize - xbsd_dlabel.d_secsize))
 		return;
 
@@ -969,7 +969,7 @@
 		d, sizeof(struct xbsd_disklabel));
 
 #if defined (__alpha__) && BSD_LABELSECTOR == 0
-	alpha_bootblock_checksum (disklabelbuffer);
+	alpha_bootblock_checksum(disklabelbuffer);
 	if (lseek(fd, 0, SEEK_SET) == -1)
 		fdisk_fatal(unable_to_seek);
 	if (BSD_BBSIZE != write(fd, disklabelbuffer, BSD_BBSIZE))

Modified: trunk/busybox/util-linux/mkfs_minix.c
===================================================================
--- trunk/busybox/util-linux/mkfs_minix.c	2006-11-30 20:57:50 UTC (rev 16741)
+++ trunk/busybox/util-linux/mkfs_minix.c	2006-11-30 21:11:01 UTC (rev 16742)
@@ -613,7 +613,8 @@
 static void check_blocks(void)
 {
 	int try, got;
-	static char buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS];
+	/* buffer[] was the biggest static in entire bbox */
+	char *buffer = xmalloc(BLOCK_SIZE * TEST_BUFFER_BLOCKS);
 
 	currently_testing = 0;
 	signal(SIGALRM, alarm_intr);
@@ -635,6 +636,7 @@
 		badblocks++;
 		currently_testing++;
 	}
+	free(buffer);
 	printf("%d bad block(s)\n", badblocks);
 }
 




More information about the busybox-cvs mailing list