Reviewers: Søren Gjesse,

Description:
Misc. portability fixes.

Please review this at http://codereview.chromium.org/42337

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     samples/shell.cc
   M     src/conversions-inl.h
   M     src/platform-linux.cc
   M     src/unicode.cc


Index: samples/shell.cc
===================================================================
--- samples/shell.cc    (revision 1536)
+++ samples/shell.cc    (working copy)
@@ -26,9 +26,10 @@
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  #include <v8.h>
-#include <cstring>
-#include <cstdio>
-#include <cstdlib>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>


  void RunShell(v8::Handle<v8::Context> context);
Index: src/conversions-inl.h
===================================================================
--- src/conversions-inl.h       (revision 1536)
+++ src/conversions-inl.h       (working copy)
@@ -30,6 +30,7 @@

  #include <math.h>
  #include <float.h>         // required for DBL_MAX and on Win32 for  
finite()
+#include <stdarg.h>

  //  
----------------------------------------------------------------------------
  // Extra POSIX/ANSI functions for Win32/MSVC.
Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc       (revision 1536)
+++ src/platform-linux.cc       (working copy)
@@ -42,8 +42,8 @@
  #include <sys/types.h>  // mmap & munmap
  #include <sys/mman.h>   // mmap & munmap
  #include <sys/stat.h>   // open
-#include <sys/fcntl.h>  // open
-#include <unistd.h>     // getpagesize
+#include <fcntl.h>      // open
+#include <unistd.h>     // sysconf
  #include <execinfo.h>   // backtrace, backtrace_symbols
  #include <strings.h>    // index
  #include <errno.h>
@@ -230,14 +230,14 @@


  size_t OS::AllocateAlignment() {
-  return getpagesize();
+  return sysconf(_SC_PAGESIZE);
  }


  void* OS::Allocate(const size_t requested,
                     size_t* allocated,
                     bool executable) {
-  const size_t msize = RoundUp(requested, getpagesize());
+  const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE));
    int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0);
    void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1,  
0);
    if (mbase == MAP_FAILED) {
Index: src/unicode.cc
===================================================================
--- src/unicode.cc      (revision 1536)
+++ src/unicode.cc      (working copy)
@@ -28,8 +28,8 @@
  // This file was generated at 2008-11-25 16:02:40.592795

  #include "unicode-inl.h"
-#include <cstdlib>
-#include <cstdio>
+#include <stdlib.h>
+#include <stdio.h>

  namespace unibrow {




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to