Bug 1413475 - Inline STRERROR_BUF in mozjemalloc.cpp. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 01 Nov 2017 16:46:44 +0900
changeset 690338 421035e0251414adbf98ea93c7a37fd8566a3ca4
parent 690337 58ea2ee542df22f2ef5e6f84d82e2e0958ea6bc7
child 690339 e10b6526a60163f55bd82a352ba691d5731774f7
push id87285
push userbmo:mh+mozilla@glandium.org
push dateWed, 01 Nov 2017 22:04:01 +0000
reviewersnjn
bugs1413475
milestone58.0a1
Bug 1413475 - Inline STRERROR_BUF in mozjemalloc.cpp. r?njn It is only used once.
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -244,19 +244,16 @@ static inline void*
 #endif
 #endif
 }
 #define mmap _mmap
 #define munmap(a, l) syscall(SYS_munmap, a, l)
 #endif
 #endif
 
-// Size of stack-allocated buffer passed to strerror_r().
-#define STRERROR_BUF 64
-
 // Minimum alignment of non-tiny allocations is 2^QUANTUM_2POW_MIN bytes.
 #define QUANTUM_2POW_MIN 4
 
 // sizeof(int) == (1U << SIZEOF_INT_2POW).
 #ifndef SIZEOF_INT_2POW
 #define SIZEOF_INT_2POW 2
 #endif
 
@@ -1546,17 +1543,17 @@ pages_unmap(void* aAddr, size_t aSize)
   }
 }
 #else
 
 static void
 pages_unmap(void* aAddr, size_t aSize)
 {
   if (munmap(aAddr, aSize) == -1) {
-    char buf[STRERROR_BUF];
+    char buf[64];
 
     if (strerror_r(errno, buf, sizeof(buf)) == 0) {
       _malloc_message(
         _getprogname(), ": (malloc) Error in munmap(): ", buf, "\n");
     }
   }
 }