mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Update brace style.
Add braces around single-line blocks, and remove line breaks before function-opening braces. This resolves #537.
This commit is contained in:
@@ -5,11 +5,12 @@
|
||||
#endif
|
||||
|
||||
bool
|
||||
mtx_init(mtx_t *mtx)
|
||||
{
|
||||
mtx_init(mtx_t *mtx) {
|
||||
#ifdef _WIN32
|
||||
if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT))
|
||||
if (!InitializeCriticalSectionAndSpinCount(&mtx->lock,
|
||||
_CRT_SPINCOUNT)) {
|
||||
return (true);
|
||||
}
|
||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||
mtx->lock = OS_UNFAIR_LOCK_INIT;
|
||||
#elif (defined(JEMALLOC_OSSPIN))
|
||||
@@ -17,8 +18,9 @@ mtx_init(mtx_t *mtx)
|
||||
#else
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
if (pthread_mutexattr_init(&attr) != 0)
|
||||
if (pthread_mutexattr_init(&attr) != 0) {
|
||||
return (true);
|
||||
}
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
|
||||
if (pthread_mutex_init(&mtx->lock, &attr) != 0) {
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
@@ -30,8 +32,7 @@ mtx_init(mtx_t *mtx)
|
||||
}
|
||||
|
||||
void
|
||||
mtx_fini(mtx_t *mtx)
|
||||
{
|
||||
mtx_fini(mtx_t *mtx) {
|
||||
#ifdef _WIN32
|
||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||
#elif (defined(JEMALLOC_OSSPIN))
|
||||
@@ -41,8 +42,7 @@ mtx_fini(mtx_t *mtx)
|
||||
}
|
||||
|
||||
void
|
||||
mtx_lock(mtx_t *mtx)
|
||||
{
|
||||
mtx_lock(mtx_t *mtx) {
|
||||
#ifdef _WIN32
|
||||
EnterCriticalSection(&mtx->lock);
|
||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||
@@ -55,8 +55,7 @@ mtx_lock(mtx_t *mtx)
|
||||
}
|
||||
|
||||
void
|
||||
mtx_unlock(mtx_t *mtx)
|
||||
{
|
||||
mtx_unlock(mtx_t *mtx) {
|
||||
#ifdef _WIN32
|
||||
LeaveCriticalSection(&mtx->lock);
|
||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||
|
||||
Reference in New Issue
Block a user