Cleaning up CYGWIN define of fread_unlocked to port

Summary: CYGWIN avoided fread_unlocked in a wrong way. Fix it to the standard way.

Test Plan: Run tests

Reviewers: anthony, kradhakrishnan, IslamAbdelRahman, yhchiang, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D42549
This commit is contained in:
sdong 2015-07-17 10:21:01 -07:00
parent 26ca893198
commit 5ec829bc4f
2 changed files with 1 additions and 5 deletions

View File

@ -53,7 +53,7 @@
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
defined(OS_ANDROID)
defined(OS_ANDROID) || defined(OS_CYGWIN)
// Use fread/fwrite/fflush on platforms without _unlocked variants
#define fread_unlocked fread
#define fwrite_unlocked fwrite

View File

@ -186,11 +186,7 @@ class PosixSequentialFile: public SequentialFile {
Status s;
size_t r = 0;
do {
#ifndef CYGWIN
r = fread_unlocked(scratch, 1, n, file_);
#else
r = fread(scratch, 1, n, file_);
#endif
} while (r == 0 && ferror(file_) && errno == EINTR);
IOSTATS_ADD(bytes_read, r);
*result = Slice(scratch, r);