svn commit: samba r20179 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_24/source/lib

jra at samba.org jra at samba.org
Fri Dec 15 01:50:06 GMT 2006


Author: jra
Date: 2006-12-15 01:50:04 +0000 (Fri, 15 Dec 2006)
New Revision: 20179

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20179

Log:
Sync up with Samba4 - remove blank lines at the
end parsing a file.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/util_file.c
   branches/SAMBA_3_0_24/source/lib/util_file.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_file.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_file.c	2006-12-15 00:49:12 UTC (rev 20178)
+++ branches/SAMBA_3_0/source/lib/util_file.c	2006-12-15 01:50:04 UTC (rev 20179)
@@ -285,9 +285,6 @@
 		return NULL;
 	}	
 	memset(ret, 0, sizeof(ret[0])*(i+2));
-	if (numlines) {
-		*numlines = i;
-	}
 
 	ret[0] = p;
 	for (s = p, i=0; s < p+size; s++) {
@@ -301,6 +298,15 @@
 		}
 	}
 
+	/* remove any blank lines at the end */
+	while (i > 0 && ret[i-1][0] == 0) {
+		i--;
+	}
+
+	if (numlines) {
+		*numlines = i;
+	}
+
 	return ret;
 }
 

Modified: branches/SAMBA_3_0_24/source/lib/util_file.c
===================================================================
--- branches/SAMBA_3_0_24/source/lib/util_file.c	2006-12-15 00:49:12 UTC (rev 20178)
+++ branches/SAMBA_3_0_24/source/lib/util_file.c	2006-12-15 01:50:04 UTC (rev 20179)
@@ -285,9 +285,6 @@
 		return NULL;
 	}	
 	memset(ret, 0, sizeof(ret[0])*(i+2));
-	if (numlines) {
-		*numlines = i;
-	}
 
 	ret[0] = p;
 	for (s = p, i=0; s < p+size; s++) {
@@ -301,6 +298,15 @@
 		}
 	}
 
+	/* remove any blank lines at the end */
+	while (i > 0 && ret[i-1][0] == 0) {
+		i--;
+	}
+
+	if (numlines) {
+		*numlines = i;
+	}
+
 	return ret;
 }
 



More information about the samba-cvs mailing list