Check for existance of CPU_COUNT macro before using it.

This resolves #485.
This commit is contained in:
Dave Watson 2016-11-02 18:22:32 -07:00 committed by Jason Evans
parent eca3bc0131
commit 6c56e194b0

View File

@ -812,8 +812,10 @@ malloc_ncpus(void)
SYSTEM_INFO si; SYSTEM_INFO si;
GetSystemInfo(&si); GetSystemInfo(&si);
result = si.dwNumberOfProcessors; result = si.dwNumberOfProcessors;
#elif defined(JEMALLOC_GLIBC_MALLOC_HOOK) #elif defined(JEMALLOC_GLIBC_MALLOC_HOOK) && defined(CPU_COUNT)
/* /*
* glibc >= 2.6 has the CPU_COUNT macro.
*
* glibc's sysconf() uses isspace(). glibc allocates for the first time * glibc's sysconf() uses isspace(). glibc allocates for the first time
* *before* setting up the isspace tables. Therefore we need a * *before* setting up the isspace tables. Therefore we need a
* different method to get the number of CPUs. * different method to get the number of CPUs.
@ -2053,6 +2055,7 @@ JEMALLOC_EXPORT void *(*__memalign_hook)(size_t alignment, size_t size) =
je_memalign; je_memalign;
# endif # endif
#ifdef CPU_COUNT
/* /*
* To enable static linking with glibc, the libc specific malloc interface must * To enable static linking with glibc, the libc specific malloc interface must
* be implemented also, so none of glibc's malloc.o functions are added to the * be implemented also, so none of glibc's malloc.o functions are added to the
@ -2071,6 +2074,9 @@ int __posix_memalign(void** r, size_t a, size_t s)
PREALIAS(je_posix_memalign); PREALIAS(je_posix_memalign);
#undef PREALIAS #undef PREALIAS
#undef ALIAS #undef ALIAS
#endif
#endif #endif
/* /*