svn commit: samba r20091 - in branches/SAMBA_4_0/source/lib/util: .
tridge at samba.org
tridge at samba.org
Sat Dec 9 03:12:33 GMT 2006
Author: tridge
Date: 2006-12-09 03:12:33 +0000 (Sat, 09 Dec 2006)
New Revision: 20091
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20091
Log:
remove blank lines at the end of text lines loaded from a file
Modified:
branches/SAMBA_4_0/source/lib/util/util_file.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/util_file.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util/util_file.c 2006-12-09 02:58:18 UTC (rev 20090)
+++ branches/SAMBA_4_0/source/lib/util/util_file.c 2006-12-09 03:12:33 UTC (rev 20091)
@@ -263,7 +263,6 @@
talloc_steal(ret, p);
memset(ret, 0, sizeof(ret[0])*(i+2));
- if (numlines) *numlines = i;
ret[0] = p;
for (s = p, i=0; s < p+size; s++) {
@@ -275,6 +274,13 @@
if (s[0] == '\r') s[0] = 0;
}
+ /* 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