git.samba.org
/
kai
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8b137ba
)
r20091: remove blank lines at the end of text lines loaded from a file
author
Andrew Tridgell
<tridge@samba.org>
Sat, 9 Dec 2006 03:12:33 +0000
(
03:12
+0000)
committer
Gerald (Jerry) Carter
<jerry@samba.org>
Wed, 10 Oct 2007 19:29:03 +0000
(14:29 -0500)
(This used to be commit
afcc797e8a25d99269f67e05fe57e952dd5d65bc
)
source4/lib/util/util_file.c
patch
|
blob
|
history
diff --git
a/source4/lib/util/util_file.c
b/source4/lib/util/util_file.c
index 5d7ec40b30903e93522951be3fa650f60363245b..887efb98364bea526e60cab8fbba51d056b886ad 100644
(file)
--- a/
source4/lib/util/util_file.c
+++ b/
source4/lib/util/util_file.c
@@
-263,7
+263,6
@@
static char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *
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
@@
static char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *
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;
}