Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use braces consistently

  • Loading branch information...
commit e80e0187dacc29afabc5bb9ba22c4ad4af6c7976 1 parent b70baf1
@mdempsky mdempsky authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/exception.cc
View
14 src/exception.cc
@@ -448,7 +448,7 @@ static char *emergency_malloc(size_t size)
// Only 4 emergency buffers allowed per thread!
if (info->emergencyBuffersHeld > 3) { return 0; }
- if (pthread_mutex_lock) pthread_mutex_lock(&emergency_malloc_lock);
+ if (pthread_mutex_lock) { pthread_mutex_lock(&emergency_malloc_lock); }
int buffer = -1;
while (buffer < 0)
{
@@ -459,7 +459,7 @@ static char *emergency_malloc(size_t size)
void *m = calloc(1, size);
if (0 != m)
{
- if (pthread_mutex_unlock) pthread_mutex_unlock(&emergency_malloc_lock);
+ if (pthread_mutex_unlock) { pthread_mutex_unlock(&emergency_malloc_lock); }
return (char*)m;
}
for (int i=0 ; i<16 ; i++)
@@ -476,10 +476,10 @@ static char *emergency_malloc(size_t size)
// of the emergency buffers.
if (buffer < 0)
{
- if (pthread_cond_wait) pthread_cond_wait(&emergency_malloc_wait, &emergency_malloc_lock);
+ if (pthread_cond_wait) { pthread_cond_wait(&emergency_malloc_wait, &emergency_malloc_lock); }
}
}
- if (pthread_mutex_unlock) pthread_mutex_unlock(&emergency_malloc_lock);
+ if (pthread_mutex_unlock) { pthread_mutex_unlock(&emergency_malloc_lock); }
info->emergencyBuffersHeld++;
return emergency_buffer + (1024 * buffer);
}
@@ -512,13 +512,13 @@ static void emergency_malloc_free(char *ptr)
memset((void*)ptr, 0, 1024);
// Signal the condition variable to wake up any threads that are blocking
// waiting for some space in the emergency buffer
- if (pthread_mutex_lock) pthread_mutex_lock(&emergency_malloc_lock);
+ if (pthread_mutex_lock) { pthread_mutex_lock(&emergency_malloc_lock); }
// In theory, we don't need to do this with the lock held. In practice,
// our array of bools will probably be updated using 32-bit or 64-bit
// memory operations, so this update may clobber adjacent values.
buffer_allocated[buffer] = false;
- if (pthread_cond_signal) pthread_cond_signal(&emergency_malloc_wait);
- if (pthread_mutex_lock) pthread_mutex_unlock(&emergency_malloc_lock);
+ if (pthread_cond_signal) { pthread_cond_signal(&emergency_malloc_wait); }
+ if (pthread_mutex_lock) { pthread_mutex_unlock(&emergency_malloc_lock); }
}
static char *alloc_or_die(size_t size)
Please sign in to comment.
Something went wrong with that request. Please try again.