mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
gate mallopt behind GLIBC check
This commit is contained in:
+6
-6
@@ -12,16 +12,14 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef __has_include
|
#ifdef __GLIBC__
|
||||||
#if __has_include(<jemalloc/jemalloc.h>)
|
#if __has_include(<jemalloc/jemalloc.h>)
|
||||||
#include <jemalloc/jemalloc.h>
|
#include <jemalloc/jemalloc.h>
|
||||||
#define HAS_JEMALLOC 1
|
#define HAS_JEMALLOC 1
|
||||||
#endif
|
#else
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAS_JEMALLOC
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -75,9 +73,11 @@ const char* malloc_conf = "narenas:2,dirty_decay_ms:1000,muzzy_decay_ms:5000,tca
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
#ifndef HAS_JEMALLOC
|
|
||||||
|
#if defined(__GLIBC__) && !defined(HAS_JEMALLOC)
|
||||||
mallopt(M_ARENA_MAX, 2);
|
mallopt(M_ARENA_MAX, 2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::setlocale(LC_ALL, "");
|
std::setlocale(LC_ALL, "");
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
if (std::strcmp(argv[1], "theme") == 0)
|
if (std::strcmp(argv[1], "theme") == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user