read-file: Avoid memory reallocations with regular files.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Sat, 28 Aug 2010 14:12:37 +0000 (16:12 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 28 Aug 2010 14:14:23 +0000 (16:14 +0200)
commit3e53db21df4287b43a46ad27fc2fac56b9194ffc
treea90e5450e0d7ce28a25f15970100e42784f4c385
parent5712b089a6b769e76e21cc3b5601a9e787f82092
read-file: Avoid memory reallocations with regular files.
* lib/read-file.c: Include <sys/stat.h>, <stdio.h>, <stdint.h>.
(fread_file): With regular files, use the remaining length as the
initial buffer size.  Check against overflow.
* modules/read-file (Depends-on): Add ftello, malloc-posix, stdint,
sys_stat.
ChangeLog
lib/read-file.c
modules/read-file