Fix slow readstringlist() on large files

See https://cfengine.com/dev/issues/1875 for context.