We can simplify the fstat failure case now that the GetFileSize macro has been expanded inline.
Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> --- src/Xrm.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Xrm.c b/src/Xrm.c index 4337534..49fc258 100644 --- a/src/Xrm.c +++ b/src/Xrm.c @@ -1595,18 +1595,13 @@ ReadInFile(_Xconst char *filename) */ { struct stat status_buffer; - if ( (fstat((fd), &status_buffer)) == -1 ) - size = -1; - else + if ( (fstat((fd), &status_buffer)) == -1 ) { + close (fd); + return (char *)NULL; + } else size = status_buffer.st_size; } - /* There might have been a problem trying to stat a file */ - if (size == -1) { - close (fd); - return (char *)NULL; - } - if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */ close(fd); return (char *)NULL; -- 1.7.3.2 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel