Pārlūkot izejas kodu

check for existence of posix_fadvise()

Patrick Brosi 6 gadi atpakaļ
vecāks
revīzija
00e19bfbdc
1 mainītis faili ar 2 papildinājumiem un 4 dzēšanām
  1. 2 4
      File.cpp

+ 2 - 4
File.cpp

@@ -13,10 +13,6 @@
13 13
 #include "xml/File.h"
14 14
 #include "xml/NamedEnts.h"
15 15
 
16
-#ifndef POSIX_FADV_SEQUENTIAL
17
-#define POSIX_FADV_SEQUENTIAL 2
18
-#endif
19
-
20 16
 using namespace xml;
21 17
 
22 18
 // _____________________________________________________________________________
@@ -47,7 +43,9 @@ void File::reset() {
47 43
   if (_file) close(_file);
48 44
   _file = open(_path.c_str(), O_RDONLY);
49 45
   if (_file < 0) throw XmlFileException(std::string("could not open ") + _path);
46
+#ifdef __unix__
50 47
   posix_fadvise(_file, 0, 0, POSIX_FADV_SEQUENTIAL);
48
+#endif
51 49
 
52 50
   _lastBytes = read(_file, _buffer[_which], BUFFER_S);
53 51
   _lastNewData = _lastBytes;