mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-29 23:15:49 +00:00
Remove unneeded macOS-specific code
This commit is contained in:
committed by
Nikolaos D. Bougalis
parent
db3b4dd396
commit
f8fb1f6c7d
@@ -87,51 +87,37 @@ void setCurrentThreadNameImpl (std::string const& name)
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#elif BEAST_MAC
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <time.h>
|
||||
#if BEAST_BSD
|
||||
// ???
|
||||
#elif BEAST_MAC || BEAST_IOS
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#import <objc/message.h>
|
||||
#include <ripple/beast/core/osx_ObjCHelpers.h>
|
||||
#include <ripple/beast/core/Memory.h>
|
||||
#else
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
void setCurrentThreadNameImpl (std::string const& name)
|
||||
{
|
||||
#if BEAST_IOS || (BEAST_MAC && defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||
BEAST_AUTORELEASEPOOL
|
||||
{
|
||||
[[NSThread currentThread] setName: stringToNS (name)];
|
||||
}
|
||||
#elif BEAST_LINUX
|
||||
#if (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012
|
||||
pthread_setname_np (pthread_self(), name.c_str ());
|
||||
#else
|
||||
prctl (PR_SET_NAME, name.c_str (), 0, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
pthread_setname_np(name.c_str());
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
#else // BEAST_LINUX
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
void setCurrentThreadNameImpl (std::string const& name)
|
||||
{
|
||||
pthread_setname_np(pthread_self(), name.c_str());
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif // BEAST_LINUX
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Portions of this file are from JUCE.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
Please visit http://www.juce.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_MEMORY_H_INCLUDED
|
||||
#define BEAST_MEMORY_H_INCLUDED
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <ripple/beast/core/Config.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
/** Fills a block of memory with zeros. */
|
||||
inline void zeromem (void* memory, size_t numBytes) noexcept
|
||||
{ memset (memory, 0, numBytes); }
|
||||
|
||||
/** Overwrites a structure or object with zeros. */
|
||||
template <typename Type>
|
||||
void zerostruct (Type& structure) noexcept
|
||||
{ memset (&structure, 0, sizeof (structure)); }
|
||||
|
||||
//==============================================================================
|
||||
#if BEAST_MAC || BEAST_IOS || DOXYGEN
|
||||
|
||||
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII.
|
||||
You should use the BEAST_AUTORELEASEPOOL macro to create a local auto-release pool on the stack.
|
||||
*/
|
||||
class ScopedAutoReleasePool
|
||||
{
|
||||
public:
|
||||
ScopedAutoReleasePool();
|
||||
~ScopedAutoReleasePool();
|
||||
|
||||
|
||||
ScopedAutoReleasePool(ScopedAutoReleasePool const&) = delete;
|
||||
ScopedAutoReleasePool& operator= (ScopedAutoReleasePool const&) = delete;
|
||||
|
||||
private:
|
||||
void* pool;
|
||||
};
|
||||
|
||||
/** A macro that can be used to easily declare a local ScopedAutoReleasePool
|
||||
object for RAII-based obj-C autoreleasing.
|
||||
Because this may use the \@autoreleasepool syntax, you must follow the macro with
|
||||
a set of braces to mark the scope of the pool.
|
||||
*/
|
||||
#if (BEAST_COMPILER_SUPPORTS_ARC && defined (__OBJC__)) || DOXYGEN
|
||||
#define BEAST_AUTORELEASEPOOL @autoreleasepool
|
||||
#else
|
||||
#define BEAST_AUTORELEASEPOOL const beast::ScopedAutoReleasePool BEAST_JOIN_MACRO (autoReleasePool_, __LINE__);
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define BEAST_AUTORELEASEPOOL
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -159,16 +159,6 @@
|
||||
#undef _aligned_msize
|
||||
#endif
|
||||
|
||||
#include <ripple/beast/core/Memory.h>
|
||||
|
||||
#if BEAST_MAC || BEAST_IOS
|
||||
#include <ripple/beast/core/osx_ObjCHelpers.h>
|
||||
#endif
|
||||
|
||||
#if BEAST_MAC || BEAST_IOS
|
||||
#include <ripple/beast/core/mac_SystemStats.mm>
|
||||
#endif
|
||||
|
||||
#include <ripple/beast/core/CurrentThreadName.cpp>
|
||||
#include <ripple/beast/core/SemanticVersion.cpp>
|
||||
#include <ripple/beast/core/WaitableEvent.cpp>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Portions of this file are from JUCE.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
Please visit http://www.juce.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
#include <ripple/beast/core/Memory.h>
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
ScopedAutoReleasePool::ScopedAutoReleasePool()
|
||||
{
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
}
|
||||
|
||||
ScopedAutoReleasePool::~ScopedAutoReleasePool()
|
||||
{
|
||||
[((NSAutoreleasePool*) pool) release];
|
||||
}
|
||||
|
||||
} // beast
|
||||
@@ -1,54 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Portions of this file are from JUCE.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
Please visit http://www.juce.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_MODULE_CORE_NATIVE_OSX_OBJCHELPERS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_NATIVE_OSX_OBJCHELPERS_H_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
/* This file contains a few helper functions that are used internally but which
|
||||
need to be kept away from the public headers because they use obj-C symbols.
|
||||
*/
|
||||
namespace
|
||||
{
|
||||
static inline NSString* stringToNS (std::string const& s)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
// The UTF-8 encoding function for ASCII characters
|
||||
// in the range [0-127] is the identity. We are more
|
||||
// strict and require only printable characters.
|
||||
for (auto const& c : s)
|
||||
assert (isprint(static_cast<unsigned char>(c)));
|
||||
#endif
|
||||
|
||||
return [NSString stringWithUTF8String: s.c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
} // beast
|
||||
|
||||
#endif // BEAST_OSX_OBJCHELPERS_H_INCLUDED
|
||||
Reference in New Issue
Block a user