patch-2.4.0-test9 linux/scripts/mkdep.c

Next file: linux/scripts/ver_linux
Previous file: linux/scripts/makelst
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test8/linux/scripts/mkdep.c linux/scripts/mkdep.c
@@ -81,15 +81,9 @@
  */
 void grow_config(int len)
 {
-	if (str_config == NULL) {
-		len_config  = 0;
-		size_config = 4096;
-		str_config  = malloc(4096);
-		if (str_config == NULL)
-			{ perror("malloc"); exit(1); }
-	}
-
 	while (len_config + len > size_config) {
+		if (size_config == 0)
+			size_config = 2048;
 		str_config = realloc(str_config, size_config *= 2);
 		if (str_config == NULL)
 			{ perror("malloc config"); exit(1); }
@@ -157,15 +151,9 @@
  */
 void grow_precious(int len)
 {
-	if (str_precious == NULL) {
-		len_precious  = 0;
-		size_precious = 4096;
-		str_precious  = malloc(4096);
-		if (str_precious == NULL)
-			{ perror("malloc precious"); exit(1); }
-	}
-
 	while (len_precious + len > size_precious) {
+		if (size_precious == 0)
+			size_precious = 2048;
 		str_precious = realloc(str_precious, size_precious *= 2);
 		if (str_precious == NULL)
 			{ perror("malloc"); exit(1); }
@@ -294,6 +282,7 @@
  * The state machine looks for (approximately) these Perl regular expressions:
  *
  *    m|\/\*.*?\*\/|
+ *    m|\/\/.*|
  *    m|'.*?'|
  *    m|".*?"|
  *    m|#\s*include\s*"(.*?)"|
@@ -326,9 +315,18 @@
 	CASE('C',  cee);
 	goto start;
 
+/* // */
+slash_slash:
+	GETNEXT
+	CASE('\n', start);
+	NOTCASE('\\', slash_slash);
+	GETNEXT
+	goto slash_slash;
+
 /* / */
 slash:
 	GETNEXT
+	CASE('/',  slash_slash);
 	NOTCASE('*', __start);
 slash_star_dot_star:
 	GETNEXT

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)