mirror of
https://github.com/samba-team/samba.git
synced 2025-11-09 20:23:51 +03:00
r20091: remove blank lines at the end of text lines loaded from a file
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
557bb80089
commit
afcc797e8a
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user