X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Futil%2Fos_file.c;h=5771b27e5d0730d33a0a3a95235c2432320eb9a8;hb=04dbf709edf069bc720d941fab27c53269336bcf;hp=228f1e823c5e388db01d0deb335e25d3c44d1af2;hpb=f5a8958910f53d924d062cbf024cebe4134f757a;p=mesa.git diff --git a/src/util/os_file.c b/src/util/os_file.c index 228f1e823c5..5771b27e5d0 100644 --- a/src/util/os_file.c +++ b/src/util/os_file.c @@ -67,7 +67,7 @@ readN(int fd, char *buf, size_t len) } char * -os_read_file(const char *filename) +os_read_file(const char *filename, size_t *size) { /* Note that this also serves as a slight margin to avoid a 2x grow when * the file is just a few bytes larger when we read it than when we @@ -130,6 +130,9 @@ os_read_file(const char *filename) buf[offset] = '\0'; + if (size) + *size = offset; + return buf; } @@ -150,7 +153,7 @@ os_same_file_description(int fd1, int fd2) #include "u_debug.h" char * -os_read_file(const char *filename) +os_read_file(const char *filename, size_t *size) { errno = -ENOSYS; return NULL;