svn commit: trunk/busybox/miscutils

vapier at busybox.net vapier at busybox.net
Sun Apr 16 21:30:49 UTC 2006


Author: vapier
Date: 2006-04-16 14:30:47 -0700 (Sun, 16 Apr 2006)
New Revision: 14896

Log:
use xmalloc, dont hardcode length of string, and get rid of pointless call to memset

Modified:
   trunk/busybox/miscutils/less.c


Changeset:
Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2006-04-16 21:17:00 UTC (rev 14895)
+++ trunk/busybox/miscutils/less.c	2006-04-16 21:30:47 UTC (rev 14896)
@@ -625,12 +625,11 @@
 	   insert_highlights, and then the line is returned. */
 
 	int match_status;
-	char *line2 = (char *) malloc((sizeof(char) * (strlen(line) + 1)) + 64);
+	char *line2 = (char *) xmalloc((sizeof(char) * (strlen(line) + 1)) + 64);
 	char sub_line[256];
 	int prev_eo = 0;
 	regmatch_t match_structs;
 
-	memset(sub_line, 0, 256);
 	strcpy(line2, line);
 
 	match_found = 0;
@@ -638,7 +637,7 @@
 
 	while (match_status == 0) {
 
-		memset(sub_line, 0, 256);
+		memset(sub_line, 0, sizeof(sub_line));
 
 		if (match_found == 0)
 			match_found = 1;




More information about the busybox-cvs mailing list