More efficient xml parsing

This commit is contained in:
topjohnwu
2019-03-09 04:27:04 -05:00
parent 081074ad9d
commit f24a5dfd45
2 changed files with 19 additions and 16 deletions

View File

@@ -378,8 +378,9 @@ void file_readline(const char *file, const function<bool (string_view)> &fn, boo
while ((read = getline(&buf, &len, fp)) >= 0) {
start = buf;
if (trim) {
while (buf[read - 1] == '\n' || buf[read - 1] == ' ')
buf[read-- - 1] = '\0';
while (read && (buf[read - 1] == '\n' || buf[read - 1] == ' '))
--read;
buf[read] = '\0';
while (*start == ' ')
++start;
}