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:
Jason Evans 2017-01-15 16:56:30 -08:00
parent 5154ff32ee
commit c4c2592c83
119 changed files with 2971 additions and 3572 deletions

View file

@ -3,66 +3,56 @@
#define BILLION UINT64_C(1000000000)
void
nstime_init(nstime_t *time, uint64_t ns)
{
nstime_init(nstime_t *time, uint64_t ns) {
time->ns = ns;
}
void
nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec)
{
nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec) {
time->ns = sec * BILLION + nsec;
}
uint64_t
nstime_ns(const nstime_t *time)
{
nstime_ns(const nstime_t *time) {
return (time->ns);
}
uint64_t
nstime_sec(const nstime_t *time)
{
nstime_sec(const nstime_t *time) {
return (time->ns / BILLION);
}
uint64_t
nstime_nsec(const nstime_t *time)
{
nstime_nsec(const nstime_t *time) {
return (time->ns % BILLION);
}
void
nstime_copy(nstime_t *time, const nstime_t *source)
{
nstime_copy(nstime_t *time, const nstime_t *source) {
*time = *source;
}
int
nstime_compare(const nstime_t *a, const nstime_t *b)
{
nstime_compare(const nstime_t *a, const nstime_t *b) {
return ((a->ns > b->ns) - (a->ns < b->ns));
}
void
nstime_add(nstime_t *time, const nstime_t *addend)
{
nstime_add(nstime_t *time, const nstime_t *addend) {
assert(UINT64_MAX - time->ns >= addend->ns);
time->ns += addend->ns;
}
void
nstime_subtract(nstime_t *time, const nstime_t *subtrahend)
{
nstime_subtract(nstime_t *time, const nstime_t *subtrahend) {
assert(nstime_compare(time, subtrahend) >= 0);
time->ns -= subtrahend->ns;
}
void
nstime_imultiply(nstime_t *time, uint64_t multiplier)
{
nstime_imultiply(nstime_t *time, uint64_t multiplier) {
assert((((time->ns | multiplier) & (UINT64_MAX << (sizeof(uint64_t) <<
2))) == 0) || ((time->ns * multiplier) / multiplier == time->ns));
@ -70,16 +60,14 @@ nstime_imultiply(nstime_t *time, uint64_t multiplier)
}
void
nstime_idivide(nstime_t *time, uint64_t divisor)
{
nstime_idivide(nstime_t *time, uint64_t divisor) {
assert(divisor != 0);
time->ns /= divisor;
}
uint64_t
nstime_divide(const nstime_t *time, const nstime_t *divisor)
{
nstime_divide(const nstime_t *time, const nstime_t *divisor) {
assert(divisor->ns != 0);
return (time->ns / divisor->ns);
@ -88,8 +76,7 @@ nstime_divide(const nstime_t *time, const nstime_t *divisor)
#ifdef _WIN32
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time)
{
nstime_get(nstime_t *time) {
FILETIME ft;
uint64_t ticks_100ns;
@ -101,8 +88,7 @@ nstime_get(nstime_t *time)
#elif JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time)
{
nstime_get(nstime_t *time) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
@ -111,8 +97,7 @@ nstime_get(nstime_t *time)
#elif JEMALLOC_HAVE_CLOCK_MONOTONIC
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time)
{
nstime_get(nstime_t *time) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@ -121,15 +106,13 @@ nstime_get(nstime_t *time)
#elif JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time)
{
nstime_get(nstime_t *time) {
nstime_init(time, mach_absolute_time());
}
#else
# define NSTIME_MONOTONIC false
static void
nstime_get(nstime_t *time)
{
nstime_get(nstime_t *time) {
struct timeval tv;
gettimeofday(&tv, NULL);
@ -142,8 +125,7 @@ nstime_get(nstime_t *time)
#define nstime_monotonic JEMALLOC_N(n_nstime_monotonic)
#endif
bool
nstime_monotonic(void)
{
nstime_monotonic(void) {
return (NSTIME_MONOTONIC);
#undef NSTIME_MONOTONIC
}
@ -158,8 +140,7 @@ nstime_monotonic_t *nstime_monotonic = JEMALLOC_N(n_nstime_monotonic);
#define nstime_update JEMALLOC_N(n_nstime_update)
#endif
bool
nstime_update(nstime_t *time)
{
nstime_update(nstime_t *time) {
nstime_t old_time;
nstime_copy(&old_time, time);