Update brace style.

Add braces around single-line blocks, and remove line breaks before
function-opening braces.

This resolves #537.
diff --git a/test/include/test/SFMT.h b/test/include/test/SFMT.h
index 09c1607..4ad7484 100644
--- a/test/include/test/SFMT.h
+++ b/test/include/test/SFMT.h
@@ -97,75 +97,65 @@
 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(SFMT_C_))
 /* These real versions are due to Isaku Wada */
 /** generates a random number on [0,1]-real-interval */
-JEMALLOC_INLINE double to_real1(uint32_t v)
-{
+JEMALLOC_INLINE double to_real1(uint32_t v) {
     return v * (1.0/4294967295.0); 
     /* divided by 2^32-1 */ 
 }
 
 /** generates a random number on [0,1]-real-interval */
-JEMALLOC_INLINE double genrand_real1(sfmt_t *ctx)
-{
+JEMALLOC_INLINE double genrand_real1(sfmt_t *ctx) {
     return to_real1(gen_rand32(ctx));
 }
 
 /** generates a random number on [0,1)-real-interval */
-JEMALLOC_INLINE double to_real2(uint32_t v)
-{
+JEMALLOC_INLINE double to_real2(uint32_t v) {
     return v * (1.0/4294967296.0); 
     /* divided by 2^32 */
 }
 
 /** generates a random number on [0,1)-real-interval */
-JEMALLOC_INLINE double genrand_real2(sfmt_t *ctx)
-{
+JEMALLOC_INLINE double genrand_real2(sfmt_t *ctx) {
     return to_real2(gen_rand32(ctx));
 }
 
 /** generates a random number on (0,1)-real-interval */
-JEMALLOC_INLINE double to_real3(uint32_t v)
-{
+JEMALLOC_INLINE double to_real3(uint32_t v) {
     return (((double)v) + 0.5)*(1.0/4294967296.0); 
     /* divided by 2^32 */
 }
 
 /** generates a random number on (0,1)-real-interval */
-JEMALLOC_INLINE double genrand_real3(sfmt_t *ctx)
-{
+JEMALLOC_INLINE double genrand_real3(sfmt_t *ctx) {
     return to_real3(gen_rand32(ctx));
 }
 /** These real versions are due to Isaku Wada */
 
 /** generates a random number on [0,1) with 53-bit resolution*/
-JEMALLOC_INLINE double to_res53(uint64_t v) 
-{ 
+JEMALLOC_INLINE double to_res53(uint64_t v) {
     return v * (1.0/18446744073709551616.0L);
 }
 
 /** generates a random number on [0,1) with 53-bit resolution from two
  * 32 bit integers */
-JEMALLOC_INLINE double to_res53_mix(uint32_t x, uint32_t y) 
-{ 
+JEMALLOC_INLINE double to_res53_mix(uint32_t x, uint32_t y) {
     return to_res53(x | ((uint64_t)y << 32));
 }
 
 /** generates a random number on [0,1) with 53-bit resolution
  */
-JEMALLOC_INLINE double genrand_res53(sfmt_t *ctx) 
-{ 
+JEMALLOC_INLINE double genrand_res53(sfmt_t *ctx) {
     return to_res53(gen_rand64(ctx));
-} 
+}
 
 /** generates a random number on [0,1) with 53-bit resolution
     using 32bit integer.
  */
-JEMALLOC_INLINE double genrand_res53_mix(sfmt_t *ctx) 
-{ 
+JEMALLOC_INLINE double genrand_res53_mix(sfmt_t *ctx) {
     uint32_t x, y;
 
     x = gen_rand32(ctx);
     y = gen_rand32(ctx);
     return to_res53_mix(x, y);
-} 
+}
 #endif
 #endif
diff --git a/test/include/test/btalloc.h b/test/include/test/btalloc.h
index c3f9d4d..98366af 100644
--- a/test/include/test/btalloc.h
+++ b/test/include/test/btalloc.h
@@ -8,13 +8,12 @@
 
 #define	btalloc_n_gen(n)						\
 void *									\
-btalloc_##n(size_t size, unsigned bits)					\
-{									\
+btalloc_##n(size_t size, unsigned bits) {				\
 	void *p;							\
 									\
-	if (bits == 0)							\
+	if (bits == 0) {						\
 		p = mallocx(size, 0);					\
-	else {								\
+	} else {							\
 		switch (bits & 0x1U) {					\
 		case 0:							\
 			p = (btalloc_0(size, bits >> 1));		\
diff --git a/test/include/test/extent_hooks.h b/test/include/test/extent_hooks.h
index f50747d..a664c43 100644
--- a/test/include/test/extent_hooks.h
+++ b/test/include/test/extent_hooks.h
@@ -73,8 +73,7 @@
 
 static void *
 extent_alloc_hook(extent_hooks_t *extent_hooks, void *new_addr, size_t size,
-    size_t alignment, bool *zero, bool *commit, unsigned arena_ind)
-{
+    size_t alignment, bool *zero, bool *commit, unsigned arena_ind) {
 	void *ret;
 
 	TRACE_HOOK("%s(extent_hooks=%p, new_addr=%p, size=%zu, alignment=%zu, "
@@ -86,8 +85,9 @@
 	assert_ptr_eq(extent_hooks->alloc, extent_alloc_hook,
 	    "Wrong hook function");
 	called_alloc = true;
-	if (!try_alloc)
+	if (!try_alloc) {
 		return (NULL);
+	}
 	ret = default_hooks->alloc(default_hooks, new_addr, size, alignment,
 	    zero, commit, 0);
 	did_alloc = (ret != NULL);
@@ -96,8 +96,7 @@
 
 static bool
 extent_dalloc_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    bool committed, unsigned arena_ind)
-{
+    bool committed, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, "
@@ -108,8 +107,9 @@
 	assert_ptr_eq(extent_hooks->dalloc, extent_dalloc_hook,
 	    "Wrong hook function");
 	called_dalloc = true;
-	if (!try_dalloc)
+	if (!try_dalloc) {
 		return (true);
+	}
 	err = default_hooks->dalloc(default_hooks, addr, size, committed, 0);
 	did_dalloc = !err;
 	return (err);
@@ -117,8 +117,7 @@
 
 static bool
 extent_commit_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    size_t offset, size_t length, unsigned arena_ind)
-{
+    size_t offset, size_t length, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
@@ -129,8 +128,9 @@
 	assert_ptr_eq(extent_hooks->commit, extent_commit_hook,
 	    "Wrong hook function");
 	called_commit = true;
-	if (!try_commit)
+	if (!try_commit) {
 		return (true);
+	}
 	err = default_hooks->commit(default_hooks, addr, size, offset, length,
 	    0);
 	did_commit = !err;
@@ -139,8 +139,7 @@
 
 static bool
 extent_decommit_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    size_t offset, size_t length, unsigned arena_ind)
-{
+    size_t offset, size_t length, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
@@ -151,8 +150,9 @@
 	assert_ptr_eq(extent_hooks->decommit, extent_decommit_hook,
 	    "Wrong hook function");
 	called_decommit = true;
-	if (!try_decommit)
+	if (!try_decommit) {
 		return (true);
+	}
 	err = default_hooks->decommit(default_hooks, addr, size, offset, length,
 	    0);
 	did_decommit = !err;
@@ -161,8 +161,7 @@
 
 static bool
 extent_purge_lazy_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    size_t offset, size_t length, unsigned arena_ind)
-{
+    size_t offset, size_t length, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
@@ -173,8 +172,9 @@
 	assert_ptr_eq(extent_hooks->purge_lazy, extent_purge_lazy_hook,
 	    "Wrong hook function");
 	called_purge_lazy = true;
-	if (!try_purge_lazy)
+	if (!try_purge_lazy) {
 		return (true);
+	}
 	err = default_hooks->purge_lazy == NULL ||
 	    default_hooks->purge_lazy(default_hooks, addr, size, offset, length,
 	    0);
@@ -184,8 +184,7 @@
 
 static bool
 extent_purge_forced_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    size_t offset, size_t length, unsigned arena_ind)
-{
+    size_t offset, size_t length, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
@@ -196,8 +195,9 @@
 	assert_ptr_eq(extent_hooks->purge_forced, extent_purge_forced_hook,
 	    "Wrong hook function");
 	called_purge_forced = true;
-	if (!try_purge_forced)
+	if (!try_purge_forced) {
 		return (true);
+	}
 	err = default_hooks->purge_forced == NULL ||
 	    default_hooks->purge_forced(default_hooks, addr, size, offset,
 	    length, 0);
@@ -207,8 +207,7 @@
 
 static bool
 extent_split_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    size_t size_a, size_t size_b, bool committed, unsigned arena_ind)
-{
+    size_t size_a, size_t size_b, bool committed, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, size_a=%zu, "
@@ -220,8 +219,9 @@
 	assert_ptr_eq(extent_hooks->split, extent_split_hook,
 	    "Wrong hook function");
 	called_split = true;
-	if (!try_split)
+	if (!try_split) {
 		return (true);
+	}
 	err = (default_hooks->split == NULL ||
 	    default_hooks->split(default_hooks, addr, size, size_a, size_b,
 	    committed, 0));
@@ -231,8 +231,7 @@
 
 static bool
 extent_merge_hook(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
-    void *addr_b, size_t size_b, bool committed, unsigned arena_ind)
-{
+    void *addr_b, size_t size_b, bool committed, unsigned arena_ind) {
 	bool err;
 
 	TRACE_HOOK("%s(extent_hooks=%p, addr_a=%p, size_a=%zu, addr_b=%p "
@@ -244,8 +243,9 @@
 	assert_ptr_eq(extent_hooks->merge, extent_merge_hook,
 	    "Wrong hook function");
 	called_merge = true;
-	if (!try_merge)
+	if (!try_merge) {
 		return (true);
+	}
 	err = (default_hooks->merge == NULL ||
 	    default_hooks->merge(default_hooks, addr_a, size_a, addr_b, size_b,
 	    committed, 0));
@@ -254,8 +254,7 @@
 }
 
 static void
-extent_hooks_prep(void)
-{
+extent_hooks_prep(void) {
 	size_t sz;
 
 	sz = sizeof(default_hooks);
diff --git a/test/include/test/jemalloc_test.h.in b/test/include/test/jemalloc_test.h.in
index 2dd0cde..a0b9474 100644
--- a/test/include/test/jemalloc_test.h.in
+++ b/test/include/test/jemalloc_test.h.in
@@ -159,8 +159,9 @@
 } while (0)
 
 #define	assert_not_implemented(e) do {					\
-	if (!(e))							\
+	if (!(e)) {							\
 		not_implemented();					\
+	}								\
 } while (0)
 
 #ifdef __cplusplus
diff --git a/test/include/test/math.h b/test/include/test/math.h
index 1728d60..08be69f 100644
--- a/test/include/test/math.h
+++ b/test/include/test/math.h
@@ -16,8 +16,7 @@
  *   [S14].  Communications of the ACM 9(9):684.
  */
 JEMALLOC_INLINE double
-ln_gamma(double x)
-{
+ln_gamma(double x) {
 	double f, z;
 
 	assert(x > 0.0);
@@ -31,8 +30,9 @@
 		}
 		x = z;
 		f = -log(f);
-	} else
+	} else {
 		f = 0.0;
+	}
 
 	z = 1.0 / (x * x);
 
@@ -51,8 +51,7 @@
  *   Applied Statistics 19:285-287.
  */
 JEMALLOC_INLINE double
-i_gamma(double x, double p, double ln_gamma_p)
-{
+i_gamma(double x, double p, double ln_gamma_p) {
 	double acu, factor, oflo, gin, term, rn, a, b, an, dif;
 	double pn[6];
 	unsigned i;
@@ -60,8 +59,9 @@
 	assert(p > 0.0);
 	assert(x >= 0.0);
 
-	if (x == 0.0)
+	if (x == 0.0) {
 		return (0.0);
+	}
 
 	acu = 1.0e-10;
 	oflo = 1.0e30;
@@ -99,8 +99,9 @@
 			b += 2.0;
 			term += 1.0;
 			an = a * term;
-			for (i = 0; i < 2; i++)
+			for (i = 0; i < 2; i++) {
 				pn[i+4] = b * pn[i+2] - an * pn[i];
+			}
 			if (pn[5] != 0.0) {
 				rn = pn[4] / pn[5];
 				dif = fabs(gin - rn);
@@ -110,12 +111,14 @@
 				}
 				gin = rn;
 			}
-			for (i = 0; i < 4; i++)
+			for (i = 0; i < 4; i++) {
 				pn[i] = pn[i+2];
+			}
 
 			if (fabs(pn[4]) >= oflo) {
-				for (i = 0; i < 4; i++)
+				for (i = 0; i < 4; i++) {
 					pn[i] /= oflo;
+				}
 			}
 		}
 	}
@@ -132,8 +135,7 @@
  *   distribution.  Applied Statistics 37(3):477-484.
  */
 JEMALLOC_INLINE double
-pt_norm(double p)
-{
+pt_norm(double p) {
 	double q, r, ret;
 
 	assert(p > 0.0 && p < 1.0);
@@ -153,10 +155,11 @@
 		    r + 6.8718700749205790830e2) * r + 4.2313330701600911252e1)
 		    * r + 1.0));
 	} else {
-		if (q < 0.0)
+		if (q < 0.0) {
 			r = p;
-		else
+		} else {
 			r = 1.0 - p;
+		}
 		assert(r > 0.0);
 
 		r = sqrt(-log(r));
@@ -198,8 +201,9 @@
 			    5.99832206555887937690e-1)
 			    * r + 1.0));
 		}
-		if (q < 0.0)
+		if (q < 0.0) {
 			ret = -ret;
+		}
 		return (ret);
 	}
 }
@@ -219,8 +223,7 @@
  *   points of the Chi^2 distribution.  Applied Statistics 40(1):233-235.
  */
 JEMALLOC_INLINE double
-pt_chi2(double p, double df, double ln_gamma_df_2)
-{
+pt_chi2(double p, double df, double ln_gamma_df_2) {
 	double e, aa, xx, c, ch, a, q, p1, p2, t, x, b, s1, s2, s3, s4, s5, s6;
 	unsigned i;
 
@@ -236,8 +239,9 @@
 	if (df < -1.24 * log(p)) {
 		/* Starting approximation for small Chi^2. */
 		ch = pow(p * xx * exp(ln_gamma_df_2 + xx * aa), 1.0 / xx);
-		if (ch - e < 0.0)
+		if (ch - e < 0.0) {
 			return (ch);
+		}
 	} else {
 		if (df > 0.32) {
 			x = pt_norm(p);
@@ -263,8 +267,9 @@
 				    * (13.32 + 3.0 * ch)) / p2;
 				ch -= (1.0 - exp(a + ln_gamma_df_2 + 0.5 * ch +
 				    c * aa) * p2 / p1) / t;
-				if (fabs(q / ch - 1.0) - 0.01 <= 0.0)
+				if (fabs(q / ch - 1.0) - 0.01 <= 0.0) {
 					break;
+				}
 			}
 		}
 	}
@@ -273,8 +278,9 @@
 		/* Calculation of seven-term Taylor series. */
 		q = ch;
 		p1 = 0.5 * ch;
-		if (p1 < 0.0)
+		if (p1 < 0.0) {
 			return (-1.0);
+		}
 		p2 = p - i_gamma(p1, xx, ln_gamma_df_2);
 		t = p2 * exp(xx * aa + ln_gamma_df_2 + p1 - c * log(ch));
 		b = t / ch;
@@ -290,8 +296,9 @@
 		s6 = (120.0 + c * (346.0 + 127.0 * c)) / 5040.0;
 		ch += t * (1.0 + 0.5 * t * s1 - b * c * (s1 - b * (s2 - b * (s3
 		    - b * (s4 - b * (s5 - b * s6))))));
-		if (fabs(q / ch - 1.0) <= e)
+		if (fabs(q / ch - 1.0) <= e) {
 			break;
+		}
 	}
 
 	return (ch);
@@ -303,8 +310,7 @@
  * p.
  */
 JEMALLOC_INLINE double
-pt_gamma(double p, double shape, double scale, double ln_gamma_shape)
-{
+pt_gamma(double p, double shape, double scale, double ln_gamma_shape) {
 	return (pt_chi2(p, shape * 2.0, ln_gamma_shape) * 0.5 * scale);
 }
 #endif
diff --git a/test/include/test/mq.h b/test/include/test/mq.h
index a974eb9..fd66de9 100644
--- a/test/include/test/mq.h
+++ b/test/include/test/mq.h
@@ -37,20 +37,19 @@
 a_attr bool								\
 a_prefix##init(a_mq_type *mq) {						\
 									\
-	if (mtx_init(&mq->lock))					\
+	if (mtx_init(&mq->lock)) {					\
 		return (true);						\
+	}								\
 	ql_new(&mq->msgs);						\
 	mq->count = 0;							\
 	return (false);							\
 }									\
 a_attr void								\
-a_prefix##fini(a_mq_type *mq)						\
-{									\
+a_prefix##fini(a_mq_type *mq) {						\
 	mtx_fini(&mq->lock);						\
 }									\
 a_attr unsigned								\
-a_prefix##count(a_mq_type *mq)						\
-{									\
+a_prefix##count(a_mq_type *mq) {					\
 	unsigned count;							\
 									\
 	mtx_lock(&mq->lock);						\
@@ -59,8 +58,7 @@
 	return (count);							\
 }									\
 a_attr a_mq_msg_type *							\
-a_prefix##tryget(a_mq_type *mq)						\
-{									\
+a_prefix##tryget(a_mq_type *mq) {					\
 	a_mq_msg_type *msg;						\
 									\
 	mtx_lock(&mq->lock);						\
@@ -73,32 +71,33 @@
 	return (msg);							\
 }									\
 a_attr a_mq_msg_type *							\
-a_prefix##get(a_mq_type *mq)						\
-{									\
+a_prefix##get(a_mq_type *mq) {						\
 	a_mq_msg_type *msg;						\
 	unsigned ns;							\
 									\
 	msg = a_prefix##tryget(mq);					\
-	if (msg != NULL)						\
+	if (msg != NULL) {						\
 		return (msg);						\
+	}								\
 									\
 	ns = 1;								\
 	while (true) {							\
 		mq_nanosleep(ns);					\
 		msg = a_prefix##tryget(mq);				\
-		if (msg != NULL)					\
+		if (msg != NULL) {					\
 			return (msg);					\
+		}							\
 		if (ns < 1000*1000*1000) {				\
 			/* Double sleep time, up to max 1 second. */	\
 			ns <<= 1;					\
-			if (ns > 1000*1000*1000)			\
+			if (ns > 1000*1000*1000) {			\
 				ns = 1000*1000*1000;			\
+			}						\
 		}							\
 	}								\
 }									\
 a_attr void								\
-a_prefix##put(a_mq_type *mq, a_mq_msg_type *msg)			\
-{									\
+a_prefix##put(a_mq_type *mq, a_mq_msg_type *msg) {			\
 									\
 	mtx_lock(&mq->lock);						\
 	ql_elm_new(msg, a_field);					\
diff --git a/test/include/test/test.h b/test/include/test/test.h
index 8c69fc2..a1b6f72 100644
--- a/test/include/test/test.h
+++ b/test/include/test/test.h
@@ -298,8 +298,7 @@
 
 #define	TEST_BEGIN(f)							\
 static void								\
-f(void)									\
-{									\
+f(void) {								\
 	p_test_init(#f);
 
 #define	TEST_END							\
diff --git a/test/integration/MALLOCX_ARENA.c b/test/integration/MALLOCX_ARENA.c
index 1d9e423..f706e5a 100644
--- a/test/integration/MALLOCX_ARENA.c
+++ b/test/integration/MALLOCX_ARENA.c
@@ -11,8 +11,7 @@
     ;
 
 void *
-thd_start(void *arg)
-{
+thd_start(void *arg) {
 	unsigned thread_ind = (unsigned)(uintptr_t)arg;
 	unsigned arena_ind;
 	void *p;
@@ -45,8 +44,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_MALLOCX_ARENA)
-{
+TEST_BEGIN(test_MALLOCX_ARENA) {
 	thd_t thds[NTHREADS];
 	unsigned i;
 
@@ -55,14 +53,14 @@
 		    (void *)(uintptr_t)i);
 	}
 
-	for (i = 0; i < NTHREADS; i++)
+	for (i = 0; i < NTHREADS; i++) {
 		thd_join(thds[i], NULL);
+	}
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_MALLOCX_ARENA));
 }
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c
index 52b69ac..8a3ad6b 100644
--- a/test/integration/aligned_alloc.c
+++ b/test/integration/aligned_alloc.c
@@ -8,14 +8,12 @@
  * potential OOM on e.g. 32-bit Windows.
  */
 static void
-purge(void)
-{
+purge(void) {
 	assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
 	    "Unexpected mallctl error");
 }
 
-TEST_BEGIN(test_alignment_errors)
-{
+TEST_BEGIN(test_alignment_errors) {
 	size_t alignment;
 	void *p;
 
@@ -36,8 +34,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_oom_errors)
-{
+TEST_BEGIN(test_oom_errors) {
 	size_t alignment, size;
 	void *p;
 
@@ -81,15 +78,15 @@
 }
 TEST_END
 
-TEST_BEGIN(test_alignment_and_size)
-{
+TEST_BEGIN(test_alignment_and_size) {
 #define	NITER 4
 	size_t alignment, size, total;
 	unsigned i;
 	void *ps[NITER];
 
-	for (i = 0; i < NITER; i++)
+	for (i = 0; i < NITER; i++) {
 		ps[i] = NULL;
+	}
 
 	for (alignment = 8;
 	    alignment <= MAXALIGN;
@@ -110,8 +107,9 @@
 					    alignment, size, size, buf);
 				}
 				total += malloc_usable_size(ps[i]);
-				if (total >= (MAXALIGN << 1))
+				if (total >= (MAXALIGN << 1)) {
 					break;
+				}
 			}
 			for (i = 0; i < NITER; i++) {
 				if (ps[i] != NULL) {
@@ -127,8 +125,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_alignment_errors,
 	    test_oom_errors,
diff --git a/test/integration/allocated.c b/test/integration/allocated.c
index 7570c52..555d40a 100644
--- a/test/integration/allocated.c
+++ b/test/integration/allocated.c
@@ -9,8 +9,7 @@
     ;
 
 void *
-thd_start(void *arg)
-{
+thd_start(void *arg) {
 	int err;
 	void *p;
 	uint64_t a0, a1, d0, d1;
@@ -19,15 +18,17 @@
 
 	sz = sizeof(a0);
 	if ((err = mallctl("thread.allocated", (void *)&a0, &sz, NULL, 0))) {
-		if (err == ENOENT)
+		if (err == ENOENT) {
 			goto label_ENOENT;
+		}
 		test_fail("%s(): Error in mallctl(): %s", __func__,
 		    strerror(err));
 	}
 	sz = sizeof(ap0);
 	if ((err = mallctl("thread.allocatedp", (void *)&ap0, &sz, NULL, 0))) {
-		if (err == ENOENT)
+		if (err == ENOENT) {
 			goto label_ENOENT;
+		}
 		test_fail("%s(): Error in mallctl(): %s", __func__,
 		    strerror(err));
 	}
@@ -37,16 +38,18 @@
 
 	sz = sizeof(d0);
 	if ((err = mallctl("thread.deallocated", (void *)&d0, &sz, NULL, 0))) {
-		if (err == ENOENT)
+		if (err == ENOENT) {
 			goto label_ENOENT;
+		}
 		test_fail("%s(): Error in mallctl(): %s", __func__,
 		    strerror(err));
 	}
 	sz = sizeof(dp0);
 	if ((err = mallctl("thread.deallocatedp", (void *)&dp0, &sz, NULL,
 	    0))) {
-		if (err == ENOENT)
+		if (err == ENOENT) {
 			goto label_ENOENT;
+		}
 		test_fail("%s(): Error in mallctl(): %s", __func__,
 		    strerror(err));
 	}
@@ -96,14 +99,12 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_main_thread)
-{
+TEST_BEGIN(test_main_thread) {
 	thd_start(NULL);
 }
 TEST_END
 
-TEST_BEGIN(test_subthread)
-{
+TEST_BEGIN(test_subthread) {
 	thd_t thd;
 
 	thd_create(&thd, thd_start, NULL);
@@ -112,8 +113,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	/* Run tests multiple times to check for bad interactions. */
 	return (test(
 	    test_main_thread,
diff --git a/test/integration/cpp/basic.cpp b/test/integration/cpp/basic.cpp
index b208e1d..fe8874f 100644
--- a/test/integration/cpp/basic.cpp
+++ b/test/integration/cpp/basic.cpp
@@ -1,8 +1,7 @@
 #include <memory>
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_basic)
-{
+TEST_BEGIN(test_basic) {
 	auto foo = new long(4);
 	assert_ptr_not_null(foo, "Unexpected new[] failure");
 	delete foo;
@@ -20,8 +19,7 @@
 TEST_END
 
 int
-main()
-{
+main() {
 	return (test(
 	    test_basic));
 }
diff --git a/test/integration/extent.c b/test/integration/extent.c
index 30849b0..d12c123 100644
--- a/test/integration/extent.c
+++ b/test/integration/extent.c
@@ -7,8 +7,7 @@
 #include "test/extent_hooks.h"
 
 static void
-test_extent_body(unsigned arena_ind)
-{
+test_extent_body(unsigned arena_ind) {
 	void *p;
 	size_t large0, large1, large2, sz;
 	size_t purge_mib[3];
@@ -67,15 +66,17 @@
 	xallocx_success_b = (xallocx(p, large0, 0, flags) == large0);
 	assert_d_eq(mallctlbymib(purge_mib, purge_miblen, NULL, NULL, NULL, 0),
 	    0, "Unexpected arena.%u.purge error", arena_ind);
-	if (xallocx_success_b)
+	if (xallocx_success_b) {
 		assert_true(did_split, "Expected split");
+	}
 	xallocx_success_c = (xallocx(p, large0 * 2, 0, flags) == large0 * 2);
 	if (did_split) {
 		assert_b_eq(did_decommit, did_commit,
 		    "Expected decommit/commit match");
 	}
-	if (xallocx_success_b && xallocx_success_c)
+	if (xallocx_success_b && xallocx_success_c) {
 		assert_true(did_merge, "Expected merge");
+	}
 	dallocx(p, flags);
 	try_dalloc = true;
 	try_decommit = false;
@@ -86,8 +87,7 @@
 	dallocx(p, flags);
 }
 
-TEST_BEGIN(test_extent_manual_hook)
-{
+TEST_BEGIN(test_extent_manual_hook) {
 	unsigned arena_ind;
 	size_t old_size, new_size, sz;
 	size_t hooks_mib[3];
@@ -155,8 +155,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_extent_auto_hook)
-{
+TEST_BEGIN(test_extent_auto_hook) {
 	unsigned arena_ind;
 	size_t new_size, sz;
 	extent_hooks_t *new_hooks;
@@ -174,8 +173,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_extent_manual_hook,
 	    test_extent_auto_hook));
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 7617b1b..ec04c39 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -5,8 +5,7 @@
 #endif
 
 static unsigned
-get_nsizes_impl(const char *cmd)
-{
+get_nsizes_impl(const char *cmd) {
 	unsigned ret;
 	size_t z;
 
@@ -18,14 +17,12 @@
 }
 
 static unsigned
-get_nlarge(void)
-{
+get_nlarge(void) {
 	return (get_nsizes_impl("arenas.nlextents"));
 }
 
 static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
+get_size_impl(const char *cmd, size_t ind) {
 	size_t ret;
 	size_t z;
 	size_t mib[4];
@@ -43,8 +40,7 @@
 }
 
 static size_t
-get_large_size(size_t ind)
-{
+get_large_size(size_t ind) {
 	return (get_size_impl("arenas.lextent.0.size", ind));
 }
 
@@ -54,14 +50,12 @@
  * potential OOM on e.g. 32-bit Windows.
  */
 static void
-purge(void)
-{
+purge(void) {
 	assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
 	    "Unexpected mallctl error");
 }
 
-TEST_BEGIN(test_overflow)
-{
+TEST_BEGIN(test_overflow) {
 	size_t largemax;
 
 	largemax = get_large_size(get_nlarge()-1);
@@ -81,8 +75,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_oom)
-{
+TEST_BEGIN(test_oom) {
 	size_t largemax;
 	bool oom;
 	void *ptrs[3];
@@ -96,15 +89,17 @@
 	oom = false;
 	for (i = 0; i < sizeof(ptrs) / sizeof(void *); i++) {
 		ptrs[i] = mallocx(largemax, 0);
-		if (ptrs[i] == NULL)
+		if (ptrs[i] == NULL) {
 			oom = true;
+		}
 	}
 	assert_true(oom,
 	    "Expected OOM during series of calls to mallocx(size=%zu, 0)",
 	    largemax);
 	for (i = 0; i < sizeof(ptrs) / sizeof(void *); i++) {
-		if (ptrs[i] != NULL)
+		if (ptrs[i] != NULL) {
 			dallocx(ptrs[i], 0);
+		}
 	}
 	purge();
 
@@ -122,8 +117,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_basic)
-{
+TEST_BEGIN(test_basic) {
 #define	MAXSZ (((size_t)1) << 23)
 	size_t sz;
 
@@ -160,16 +154,16 @@
 }
 TEST_END
 
-TEST_BEGIN(test_alignment_and_size)
-{
+TEST_BEGIN(test_alignment_and_size) {
 #define	MAXALIGN (((size_t)1) << 23)
 #define	NITER 4
 	size_t nsz, rsz, sz, alignment, total;
 	unsigned i;
 	void *ps[NITER];
 
-	for (i = 0; i < NITER; i++)
+	for (i = 0; i < NITER; i++) {
 		ps[i] = NULL;
+	}
 
 	for (alignment = 8;
 	    alignment <= MAXALIGN;
@@ -202,8 +196,9 @@
 				    " alignment=%zu, size=%zu", ps[i],
 				    alignment, sz);
 				total += rsz;
-				if (total >= (MAXALIGN << 1))
+				if (total >= (MAXALIGN << 1)) {
 					break;
+				}
 			}
 			for (i = 0; i < NITER; i++) {
 				if (ps[i] != NULL) {
@@ -220,8 +215,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_overflow,
 	    test_oom,
diff --git a/test/integration/overflow.c b/test/integration/overflow.c
index ad867e7..a7f4b51 100644
--- a/test/integration/overflow.c
+++ b/test/integration/overflow.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_overflow)
-{
+TEST_BEGIN(test_overflow) {
 	unsigned nlextents;
 	size_t mib[4];
 	size_t sz, miblen, max_size_class;
@@ -41,8 +40,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_overflow));
 }
diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c
index dace10f..6bbf183 100644
--- a/test/integration/posix_memalign.c
+++ b/test/integration/posix_memalign.c
@@ -8,14 +8,12 @@
  * potential OOM on e.g. 32-bit Windows.
  */
 static void
-purge(void)
-{
+purge(void) {
 	assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
 	    "Unexpected mallctl error");
 }
 
-TEST_BEGIN(test_alignment_errors)
-{
+TEST_BEGIN(test_alignment_errors) {
 	size_t alignment;
 	void *p;
 
@@ -34,8 +32,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_oom_errors)
-{
+TEST_BEGIN(test_oom_errors) {
 	size_t alignment, size;
 	void *p;
 
@@ -73,16 +70,16 @@
 }
 TEST_END
 
-TEST_BEGIN(test_alignment_and_size)
-{
+TEST_BEGIN(test_alignment_and_size) {
 #define	NITER 4
 	size_t alignment, size, total;
 	unsigned i;
 	int err;
 	void *ps[NITER];
 
-	for (i = 0; i < NITER; i++)
+	for (i = 0; i < NITER; i++) {
 		ps[i] = NULL;
+	}
 
 	for (alignment = 8;
 	    alignment <= MAXALIGN;
@@ -104,8 +101,9 @@
 					    alignment, size, size, buf);
 				}
 				total += malloc_usable_size(ps[i]);
-				if (total >= (MAXALIGN << 1))
+				if (total >= (MAXALIGN << 1)) {
 					break;
+				}
 			}
 			for (i = 0; i < NITER; i++) {
 				if (ps[i] != NULL) {
@@ -121,8 +119,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_alignment_errors,
 	    test_oom_errors,
diff --git a/test/integration/rallocx.c b/test/integration/rallocx.c
index 0a8b50c..176b995 100644
--- a/test/integration/rallocx.c
+++ b/test/integration/rallocx.c
@@ -1,8 +1,7 @@
 #include "test/jemalloc_test.h"
 
 static unsigned
-get_nsizes_impl(const char *cmd)
-{
+get_nsizes_impl(const char *cmd) {
 	unsigned ret;
 	size_t z;
 
@@ -14,14 +13,12 @@
 }
 
 static unsigned
-get_nlarge(void)
-{
+get_nlarge(void) {
 	return (get_nsizes_impl("arenas.nlextents"));
 }
 
 static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
+get_size_impl(const char *cmd, size_t ind) {
 	size_t ret;
 	size_t z;
 	size_t mib[4];
@@ -39,13 +36,11 @@
 }
 
 static size_t
-get_large_size(size_t ind)
-{
+get_large_size(size_t ind) {
 	return (get_size_impl("arenas.lextent.0.size", ind));
 }
 
-TEST_BEGIN(test_grow_and_shrink)
-{
+TEST_BEGIN(test_grow_and_shrink) {
 	void *p, *q;
 	size_t tsz;
 #define	NCYCLES 3
@@ -90,8 +85,7 @@
 TEST_END
 
 static bool
-validate_fill(const void *p, uint8_t c, size_t offset, size_t len)
-{
+validate_fill(const void *p, uint8_t c, size_t offset, size_t len) {
 	bool ret = false;
 	const uint8_t *buf = (const uint8_t *)p;
 	size_t i;
@@ -109,8 +103,7 @@
 	return (ret);
 }
 
-TEST_BEGIN(test_zero)
-{
+TEST_BEGIN(test_zero) {
 	void *p, *q;
 	size_t psz, qsz, i, j;
 	size_t start_sizes[] = {1, 3*1024, 63*1024, 4095*1024};
@@ -154,8 +147,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_align)
-{
+TEST_BEGIN(test_align) {
 	void *p, *q;
 	size_t align;
 #define	MAX_ALIGN (ZU(1) << 25)
@@ -179,8 +171,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_lg_align_and_zero)
-{
+TEST_BEGIN(test_lg_align_and_zero) {
 	void *p, *q;
 	unsigned lg_align;
 	size_t sz;
@@ -217,8 +208,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_overflow)
-{
+TEST_BEGIN(test_overflow) {
 	size_t largemax;
 	void *p;
 
@@ -245,8 +235,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_grow_and_shrink,
 	    test_zero,
diff --git a/test/integration/sdallocx.c b/test/integration/sdallocx.c
index 5d0a8f8..bf2fd2c 100644
--- a/test/integration/sdallocx.c
+++ b/test/integration/sdallocx.c
@@ -3,21 +3,20 @@
 #define	MAXALIGN (((size_t)1) << 22)
 #define	NITER 3
 
-TEST_BEGIN(test_basic)
-{
+TEST_BEGIN(test_basic) {
 	void *ptr = mallocx(64, 0);
 	sdallocx(ptr, 64, 0);
 }
 TEST_END
 
-TEST_BEGIN(test_alignment_and_size)
-{
+TEST_BEGIN(test_alignment_and_size) {
 	size_t nsz, sz, alignment, total;
 	unsigned i;
 	void *ps[NITER];
 
-	for (i = 0; i < NITER; i++)
+	for (i = 0; i < NITER; i++) {
 		ps[i] = NULL;
+	}
 
 	for (alignment = 8;
 	    alignment <= MAXALIGN;
@@ -32,8 +31,9 @@
 				ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) |
 				    MALLOCX_ZERO);
 				total += nsz;
-				if (total >= (MAXALIGN << 1))
+				if (total >= (MAXALIGN << 1)) {
 					break;
+				}
 			}
 			for (i = 0; i < NITER; i++) {
 				if (ps[i] != NULL) {
@@ -48,8 +48,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_basic,
 	    test_alignment_and_size));
diff --git a/test/integration/thread_arena.c b/test/integration/thread_arena.c
index cf8240d..5adb5ce 100644
--- a/test/integration/thread_arena.c
+++ b/test/integration/thread_arena.c
@@ -3,8 +3,7 @@
 #define	NTHREADS 10
 
 void *
-thd_start(void *arg)
-{
+thd_start(void *arg) {
 	unsigned main_arena_ind = *(unsigned *)arg;
 	void *p;
 	unsigned arena_ind;
@@ -38,8 +37,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_thread_arena)
-{
+TEST_BEGIN(test_thread_arena) {
 	void *p;
 	unsigned arena_ind;
 	size_t size;
@@ -73,8 +71,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_thread_arena));
 }
diff --git a/test/integration/thread_tcache_enabled.c b/test/integration/thread_tcache_enabled.c
index 1394371..117d06b 100644
--- a/test/integration/thread_tcache_enabled.c
+++ b/test/integration/thread_tcache_enabled.c
@@ -9,8 +9,7 @@
     ;
 
 void *
-thd_start(void *arg)
-{
+thd_start(void *arg) {
 	int err;
 	size_t sz;
 	bool e0, e1;
@@ -84,14 +83,12 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_main_thread)
-{
+TEST_BEGIN(test_main_thread) {
 	thd_start(NULL);
 }
 TEST_END
 
-TEST_BEGIN(test_subthread)
-{
+TEST_BEGIN(test_subthread) {
 	thd_t thd;
 
 	thd_create(&thd, thd_start, NULL);
@@ -100,8 +97,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	/* Run tests multiple times to check for bad interactions. */
 	return (test(
 	    test_main_thread,
diff --git a/test/integration/xallocx.c b/test/integration/xallocx.c
index 647404a..9b4b68e 100644
--- a/test/integration/xallocx.c
+++ b/test/integration/xallocx.c
@@ -10,8 +10,7 @@
  * xallocx() would ordinarily be able to extend.
  */
 static unsigned
-arena_ind(void)
-{
+arena_ind(void) {
 	static unsigned ind = 0;
 
 	if (ind == 0) {
@@ -23,8 +22,7 @@
 	return (ind);
 }
 
-TEST_BEGIN(test_same_size)
-{
+TEST_BEGIN(test_same_size) {
 	void *p;
 	size_t sz, tsz;
 
@@ -39,8 +37,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_extra_no_move)
-{
+TEST_BEGIN(test_extra_no_move) {
 	void *p;
 	size_t sz, tsz;
 
@@ -55,8 +52,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_no_move_fail)
-{
+TEST_BEGIN(test_no_move_fail) {
 	void *p;
 	size_t sz, tsz;
 
@@ -72,8 +68,7 @@
 TEST_END
 
 static unsigned
-get_nsizes_impl(const char *cmd)
-{
+get_nsizes_impl(const char *cmd) {
 	unsigned ret;
 	size_t z;
 
@@ -85,20 +80,17 @@
 }
 
 static unsigned
-get_nsmall(void)
-{
+get_nsmall(void) {
 	return (get_nsizes_impl("arenas.nbins"));
 }
 
 static unsigned
-get_nlarge(void)
-{
+get_nlarge(void) {
 	return (get_nsizes_impl("arenas.nlextents"));
 }
 
 static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
+get_size_impl(const char *cmd, size_t ind) {
 	size_t ret;
 	size_t z;
 	size_t mib[4];
@@ -116,19 +108,16 @@
 }
 
 static size_t
-get_small_size(size_t ind)
-{
+get_small_size(size_t ind) {
 	return (get_size_impl("arenas.bin.0.size", ind));
 }
 
 static size_t
-get_large_size(size_t ind)
-{
+get_large_size(size_t ind) {
 	return (get_size_impl("arenas.lextent.0.size", ind));
 }
 
-TEST_BEGIN(test_size)
-{
+TEST_BEGIN(test_size) {
 	size_t small0, largemax;
 	void *p;
 
@@ -157,8 +146,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_size_extra_overflow)
-{
+TEST_BEGIN(test_size_extra_overflow) {
 	size_t small0, largemax;
 	void *p;
 
@@ -189,8 +177,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_extra_small)
-{
+TEST_BEGIN(test_extra_small) {
 	size_t small0, small1, largemax;
 	void *p;
 
@@ -221,8 +208,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_extra_large)
-{
+TEST_BEGIN(test_extra_large) {
 	int flags = MALLOCX_ARENA(arena_ind());
 	size_t smallmax, large1, large2, large3, largemax;
 	void *p;
@@ -292,8 +278,7 @@
 TEST_END
 
 static void
-print_filled_extents(const void *p, uint8_t c, size_t len)
-{
+print_filled_extents(const void *p, uint8_t c, size_t len) {
 	const uint8_t *pc = (const uint8_t *)p;
 	size_t i, range0;
 	uint8_t c0;
@@ -312,26 +297,26 @@
 }
 
 static bool
-validate_fill(const void *p, uint8_t c, size_t offset, size_t len)
-{
+validate_fill(const void *p, uint8_t c, size_t offset, size_t len) {
 	const uint8_t *pc = (const uint8_t *)p;
 	bool err;
 	size_t i;
 
 	for (i = offset, err = false; i < offset+len; i++) {
-		if (pc[i] != c)
+		if (pc[i] != c) {
 			err = true;
+		}
 	}
 
-	if (err)
+	if (err) {
 		print_filled_extents(p, c, offset + len);
+	}
 
 	return (err);
 }
 
 static void
-test_zero(size_t szmin, size_t szmax)
-{
+test_zero(size_t szmin, size_t szmax) {
 	int flags = MALLOCX_ARENA(arena_ind()) | MALLOCX_ZERO;
 	size_t sz, nsz;
 	void *p;
@@ -378,8 +363,7 @@
 	dallocx(p, flags);
 }
 
-TEST_BEGIN(test_zero_large)
-{
+TEST_BEGIN(test_zero_large) {
 	size_t large0, large1;
 
 	/* Get size classes. */
@@ -391,8 +375,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_same_size,
 	    test_extra_no_move,
diff --git a/test/src/btalloc.c b/test/src/btalloc.c
index a78cb89..bc31f9b 100644
--- a/test/src/btalloc.c
+++ b/test/src/btalloc.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
 void *
-btalloc(size_t size, unsigned bits)
-{
+btalloc(size_t size, unsigned bits) {
 	return (btalloc_0(size, bits));
 }
diff --git a/test/src/mq.c b/test/src/mq.c
index 47f362c..9b5f672 100644
--- a/test/src/mq.c
+++ b/test/src/mq.c
@@ -5,8 +5,7 @@
  * time is guaranteed.
  */
 void
-mq_nanosleep(unsigned ns)
-{
+mq_nanosleep(unsigned ns) {
 	assert(ns <= 1000*1000*1000);
 
 #ifdef _WIN32
diff --git a/test/src/mtx.c b/test/src/mtx.c
index bbfec4a..924ba28 100644
--- a/test/src/mtx.c
+++ b/test/src/mtx.c
@@ -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 @@
 #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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 void
-mtx_unlock(mtx_t *mtx)
-{
+mtx_unlock(mtx_t *mtx) {
 #ifdef _WIN32
 	LeaveCriticalSection(&mtx->lock);
 #elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
diff --git a/test/src/test.c b/test/src/test.c
index 345cc1c..1155326 100644
--- a/test/src/test.c
+++ b/test/src/test.c
@@ -7,8 +7,7 @@
 
 JEMALLOC_FORMAT_PRINTF(1, 2)
 void
-test_skip(const char *format, ...)
-{
+test_skip(const char *format, ...) {
 	va_list ap;
 
 	va_start(ap, format);
@@ -20,8 +19,7 @@
 
 JEMALLOC_FORMAT_PRINTF(1, 2)
 void
-test_fail(const char *format, ...)
-{
+test_fail(const char *format, ...) {
 	va_list ap;
 
 	va_start(ap, format);
@@ -32,8 +30,7 @@
 }
 
 static const char *
-test_status_string(test_status_t test_status)
-{
+test_status_string(test_status_t test_status) {
 	switch (test_status) {
 	case test_status_pass: return "pass";
 	case test_status_skip: return "skip";
@@ -43,23 +40,20 @@
 }
 
 void
-p_test_init(const char *name)
-{
+p_test_init(const char *name) {
 	test_count++;
 	test_status = test_status_pass;
 	test_name = name;
 }
 
 void
-p_test_fini(void)
-{
+p_test_fini(void) {
 	test_counts[test_status]++;
 	malloc_printf("%s: %s\n", test_name, test_status_string(test_status));
 }
 
 static test_status_t
-p_test_impl(bool do_malloc_init, test_t *t, va_list ap)
-{
+p_test_impl(bool do_malloc_init, test_t *t, va_list ap) {
 	test_status_t ret;
 
 	if (do_malloc_init) {
@@ -78,8 +72,9 @@
 	ret = test_status_pass;
 	for (; t != NULL; t = va_arg(ap, test_t *)) {
 		t();
-		if (test_status > ret)
+		if (test_status > ret) {
 			ret = test_status;
+		}
 	}
 
 	malloc_printf("--- %s: %u/%u, %s: %u/%u, %s: %u/%u ---\n",
@@ -94,8 +89,7 @@
 }
 
 test_status_t
-p_test(test_t *t, ...)
-{
+p_test(test_t *t, ...) {
 	test_status_t ret;
 	va_list ap;
 
@@ -108,8 +102,7 @@
 }
 
 test_status_t
-p_test_no_malloc_init(test_t *t, ...)
-{
+p_test_no_malloc_init(test_t *t, ...) {
 	test_status_t ret;
 	va_list ap;
 
@@ -122,8 +115,7 @@
 }
 
 void
-p_test_fail(const char *prefix, const char *message)
-{
+p_test_fail(const char *prefix, const char *message) {
 	malloc_cprintf(NULL, NULL, "%s%s\n", prefix, message);
 	test_status = test_status_fail;
 }
diff --git a/test/src/thd.c b/test/src/thd.c
index e316708..9a15eab 100644
--- a/test/src/thd.c
+++ b/test/src/thd.c
@@ -2,17 +2,16 @@
 
 #ifdef _WIN32
 void
-thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
-{
+thd_create(thd_t *thd, void *(*proc)(void *), void *arg) {
 	LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc;
 	*thd = CreateThread(NULL, 0, routine, arg, 0, NULL);
-	if (*thd == NULL)
+	if (*thd == NULL) {
 		test_fail("Error in CreateThread()\n");
+	}
 }
 
 void
-thd_join(thd_t thd, void **ret)
-{
+thd_join(thd_t thd, void **ret) {
 	if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) {
 		DWORD exit_code;
 		GetExitCodeThread(thd, (LPDWORD) &exit_code);
@@ -22,15 +21,14 @@
 
 #else
 void
-thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
-{
-	if (pthread_create(thd, NULL, proc, arg) != 0)
+thd_create(thd_t *thd, void *(*proc)(void *), void *arg) {
+	if (pthread_create(thd, NULL, proc, arg) != 0) {
 		test_fail("Error in pthread_create()\n");
+	}
 }
 
 void
-thd_join(thd_t thd, void **ret)
-{
+thd_join(thd_t thd, void **ret) {
 	pthread_join(thd, ret);
 }
 #endif
diff --git a/test/src/timer.c b/test/src/timer.c
index 82f69d0..1b18633 100644
--- a/test/src/timer.c
+++ b/test/src/timer.c
@@ -1,22 +1,19 @@
 #include "test/jemalloc_test.h"
 
 void
-timer_start(timedelta_t *timer)
-{
+timer_start(timedelta_t *timer) {
 	nstime_init(&timer->t0, 0);
 	nstime_update(&timer->t0);
 }
 
 void
-timer_stop(timedelta_t *timer)
-{
+timer_stop(timedelta_t *timer) {
 	nstime_copy(&timer->t1, &timer->t0);
 	nstime_update(&timer->t1);
 }
 
 uint64_t
-timer_usec(const timedelta_t *timer)
-{
+timer_usec(const timedelta_t *timer) {
 	nstime_t delta;
 
 	nstime_copy(&delta, &timer->t1);
@@ -25,8 +22,7 @@
 }
 
 void
-timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen)
-{
+timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen) {
 	uint64_t t0 = timer_usec(a);
 	uint64_t t1 = timer_usec(b);
 	uint64_t mult;
@@ -36,11 +32,13 @@
 	/* Whole. */
 	n = malloc_snprintf(&buf[i], buflen-i, "%"FMTu64, t0 / t1);
 	i += n;
-	if (i >= buflen)
+	if (i >= buflen) {
 		return;
+	}
 	mult = 1;
-	for (j = 0; j < n; j++)
+	for (j = 0; j < n; j++) {
 		mult *= 10;
+	}
 
 	/* Decimal. */
 	n = malloc_snprintf(&buf[i], buflen-i, ".");
diff --git a/test/stress/microbench.c b/test/stress/microbench.c
index c599d9d..3b7e966 100644
--- a/test/stress/microbench.c
+++ b/test/stress/microbench.c
@@ -2,22 +2,22 @@
 
 JEMALLOC_INLINE_C void
 time_func(timedelta_t *timer, uint64_t nwarmup, uint64_t niter,
-    void (*func)(void))
-{
+    void (*func)(void)) {
 	uint64_t i;
 
-	for (i = 0; i < nwarmup; i++)
+	for (i = 0; i < nwarmup; i++) {
 		func();
+	}
 	timer_start(timer);
-	for (i = 0; i < niter; i++)
+	for (i = 0; i < niter; i++) {
 		func();
+	}
 	timer_stop(timer);
 }
 
 void
 compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
-    void (*func_a), const char *name_b, void (*func_b))
-{
+    void (*func_a), const char *name_b, void (*func_b)) {
 	timedelta_t timer_a, timer_b;
 	char ratio_buf[6];
 	void *p;
@@ -41,8 +41,7 @@
 }
 
 static void
-malloc_free(void)
-{
+malloc_free(void) {
 	/* The compiler can optimize away free(malloc(1))! */
 	void *p = malloc(1);
 	if (p == NULL) {
@@ -53,8 +52,7 @@
 }
 
 static void
-mallocx_free(void)
-{
+mallocx_free(void) {
 	void *p = mallocx(1, 0);
 	if (p == NULL) {
 		test_fail("Unexpected mallocx() failure");
@@ -63,16 +61,14 @@
 	free(p);
 }
 
-TEST_BEGIN(test_malloc_vs_mallocx)
-{
+TEST_BEGIN(test_malloc_vs_mallocx) {
 	compare_funcs(10*1000*1000, 100*1000*1000, "malloc",
 	    malloc_free, "mallocx", mallocx_free);
 }
 TEST_END
 
 static void
-malloc_dallocx(void)
-{
+malloc_dallocx(void) {
 	void *p = malloc(1);
 	if (p == NULL) {
 		test_fail("Unexpected malloc() failure");
@@ -82,8 +78,7 @@
 }
 
 static void
-malloc_sdallocx(void)
-{
+malloc_sdallocx(void) {
 	void *p = malloc(1);
 	if (p == NULL) {
 		test_fail("Unexpected malloc() failure");
@@ -92,23 +87,20 @@
 	sdallocx(p, 1, 0);
 }
 
-TEST_BEGIN(test_free_vs_dallocx)
-{
+TEST_BEGIN(test_free_vs_dallocx) {
 	compare_funcs(10*1000*1000, 100*1000*1000, "free", malloc_free,
 	    "dallocx", malloc_dallocx);
 }
 TEST_END
 
-TEST_BEGIN(test_dallocx_vs_sdallocx)
-{
+TEST_BEGIN(test_dallocx_vs_sdallocx) {
 	compare_funcs(10*1000*1000, 100*1000*1000, "dallocx", malloc_dallocx,
 	    "sdallocx", malloc_sdallocx);
 }
 TEST_END
 
 static void
-malloc_mus_free(void)
-{
+malloc_mus_free(void) {
 	void *p;
 
 	p = malloc(1);
@@ -121,8 +113,7 @@
 }
 
 static void
-malloc_sallocx_free(void)
-{
+malloc_sallocx_free(void) {
 	void *p;
 
 	p = malloc(1);
@@ -130,21 +121,20 @@
 		test_fail("Unexpected malloc() failure");
 		return;
 	}
-	if (sallocx(p, 0) < 1)
+	if (sallocx(p, 0) < 1) {
 		test_fail("Unexpected sallocx() failure");
+	}
 	free(p);
 }
 
-TEST_BEGIN(test_mus_vs_sallocx)
-{
+TEST_BEGIN(test_mus_vs_sallocx) {
 	compare_funcs(10*1000*1000, 100*1000*1000, "malloc_usable_size",
 	    malloc_mus_free, "sallocx", malloc_sallocx_free);
 }
 TEST_END
 
 static void
-malloc_nallocx_free(void)
-{
+malloc_nallocx_free(void) {
 	void *p;
 
 	p = malloc(1);
@@ -152,21 +142,20 @@
 		test_fail("Unexpected malloc() failure");
 		return;
 	}
-	if (nallocx(1, 0) < 1)
+	if (nallocx(1, 0) < 1) {
 		test_fail("Unexpected nallocx() failure");
+	}
 	free(p);
 }
 
-TEST_BEGIN(test_sallocx_vs_nallocx)
-{
+TEST_BEGIN(test_sallocx_vs_nallocx) {
 	compare_funcs(10*1000*1000, 100*1000*1000, "sallocx",
 	    malloc_sallocx_free, "nallocx", malloc_nallocx_free);
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_malloc_vs_mallocx,
 	    test_free_vs_dallocx,
diff --git a/test/unit/SFMT.c b/test/unit/SFMT.c
index cf52670..b1bcf3d 100644
--- a/test/unit/SFMT.c
+++ b/test/unit/SFMT.c
@@ -1449,8 +1449,7 @@
 	KQU(15570163926716513029), KQU(13356980519185762498)
 };
 
-TEST_BEGIN(test_gen_rand_32)
-{
+TEST_BEGIN(test_gen_rand_32) {
 	uint32_t array32[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
 	uint32_t array32_2[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
 	int i;
@@ -1484,8 +1483,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_by_array_32)
-{
+TEST_BEGIN(test_by_array_32) {
 	uint32_t array32[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
 	uint32_t array32_2[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
 	int i;
@@ -1520,8 +1518,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_gen_rand_64)
-{
+TEST_BEGIN(test_gen_rand_64) {
 	uint64_t array64[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
 	uint64_t array64_2[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
 	int i;
@@ -1556,8 +1553,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_by_array_64)
-{
+TEST_BEGIN(test_by_array_64) {
 	uint64_t array64[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
 	uint64_t array64_2[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
 	int i;
@@ -1594,8 +1590,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_gen_rand_32,
 	    test_by_array_32,
diff --git a/test/unit/a0.c b/test/unit/a0.c
index 87f7e52..c7ce8cf 100644
--- a/test/unit/a0.c
+++ b/test/unit/a0.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_a0)
-{
+TEST_BEGIN(test_a0) {
 	void *p;
 
 	p = a0malloc(1);
@@ -11,8 +10,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test_no_malloc_init(
 	    test_a0));
 }
diff --git a/test/unit/arena_reset.c b/test/unit/arena_reset.c
index 257f972..710aaf5 100644
--- a/test/unit/arena_reset.c
+++ b/test/unit/arena_reset.c
@@ -5,8 +5,7 @@
 #include "test/extent_hooks.h"
 
 static unsigned
-get_nsizes_impl(const char *cmd)
-{
+get_nsizes_impl(const char *cmd) {
 	unsigned ret;
 	size_t z;
 
@@ -18,20 +17,17 @@
 }
 
 static unsigned
-get_nsmall(void)
-{
+get_nsmall(void) {
 	return (get_nsizes_impl("arenas.nbins"));
 }
 
 static unsigned
-get_nlarge(void)
-{
+get_nlarge(void) {
 	return (get_nsizes_impl("arenas.nlextents"));
 }
 
 static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
+get_size_impl(const char *cmd, size_t ind) {
 	size_t ret;
 	size_t z;
 	size_t mib[4];
@@ -49,35 +45,33 @@
 }
 
 static size_t
-get_small_size(size_t ind)
-{
+get_small_size(size_t ind) {
 	return (get_size_impl("arenas.bin.0.size", ind));
 }
 
 static size_t
-get_large_size(size_t ind)
-{
+get_large_size(size_t ind) {
 	return (get_size_impl("arenas.lextent.0.size", ind));
 }
 
 /* Like ivsalloc(), but safe to call on discarded allocations. */
 static size_t
-vsalloc(tsdn_t *tsdn, const void *ptr)
-{
+vsalloc(tsdn_t *tsdn, const void *ptr) {
 	extent_t *extent;
 
 	extent = extent_lookup(tsdn, ptr, false);
-	if (extent == NULL)
+	if (extent == NULL) {
 		return (0);
-	if (!extent_active_get(extent))
+	}
+	if (!extent_active_get(extent)) {
 		return (0);
+	}
 
 	return (isalloc(tsdn, extent, ptr));
 }
 
 static unsigned
-do_arena_create(extent_hooks_t *h)
-{
+do_arena_create(extent_hooks_t *h) {
 	unsigned arena_ind;
 	size_t sz = sizeof(unsigned);
 	assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz,
@@ -87,8 +81,7 @@
 }
 
 static void
-do_arena_reset_pre(unsigned arena_ind, void ***ptrs, unsigned *nptrs)
-{
+do_arena_reset_pre(unsigned arena_ind, void ***ptrs, unsigned *nptrs) {
 #define	NLARGE	32
 	unsigned nsmall, nlarge, i;
 	size_t sz;
@@ -127,8 +120,7 @@
 }
 
 static void
-do_arena_reset_post(void **ptrs, unsigned nptrs)
-{
+do_arena_reset_post(void **ptrs, unsigned nptrs) {
 	tsdn_t *tsdn;
 	unsigned i;
 
@@ -144,8 +136,7 @@
 }
 
 static void
-do_arena_reset_destroy(const char *name, unsigned arena_ind)
-{
+do_arena_reset_destroy(const char *name, unsigned arena_ind) {
 	size_t mib[3];
 	size_t miblen;
 
@@ -158,19 +149,16 @@
 }
 
 static void
-do_arena_reset(unsigned arena_ind)
-{
+do_arena_reset(unsigned arena_ind) {
 	do_arena_reset_destroy("arena.0.reset", arena_ind);
 }
 
 static void
-do_arena_destroy(unsigned arena_ind)
-{
+do_arena_destroy(unsigned arena_ind) {
 	do_arena_reset_destroy("arena.0.destroy", arena_ind);
 }
 
-TEST_BEGIN(test_arena_reset)
-{
+TEST_BEGIN(test_arena_reset) {
 	unsigned arena_ind;
 	void **ptrs;
 	unsigned nptrs;
@@ -183,8 +171,7 @@
 TEST_END
 
 static bool
-arena_i_initialized(unsigned arena_ind, bool refresh)
-{
+arena_i_initialized(unsigned arena_ind, bool refresh) {
 	bool initialized;
 	size_t mib[3];
 	size_t miblen, sz;
@@ -206,15 +193,13 @@
 	return (initialized);
 }
 
-TEST_BEGIN(test_arena_destroy_initial)
-{
+TEST_BEGIN(test_arena_destroy_initial) {
 	assert_false(arena_i_initialized(MALLCTL_ARENAS_DESTROYED, false),
 	    "Destroyed arena stats should not be initialized");
 }
 TEST_END
 
-TEST_BEGIN(test_arena_destroy_hooks_default)
-{
+TEST_BEGIN(test_arena_destroy_hooks_default) {
 	unsigned arena_ind, arena_ind_another, arena_ind_prev;
 	void **ptrs;
 	unsigned nptrs;
@@ -260,8 +245,7 @@
  */
 static bool
 extent_dalloc_unmap(extent_hooks_t *extent_hooks, void *addr, size_t size,
-    bool committed, unsigned arena_ind)
-{
+    bool committed, unsigned arena_ind) {
 	TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, "
 	    "arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ?
 	    "true" : "false", arena_ind);
@@ -270,8 +254,9 @@
 	assert_ptr_eq(extent_hooks->dalloc, extent_dalloc_unmap,
 	    "Wrong hook function");
 	called_dalloc = true;
-	if (!try_dalloc)
+	if (!try_dalloc) {
 		return (true);
+	}
 	pages_unmap(addr, size);
 	did_dalloc = true;
 	return (false);
@@ -290,8 +275,7 @@
 	extent_merge_hook
 };
 
-TEST_BEGIN(test_arena_destroy_hooks_unmap)
-{
+TEST_BEGIN(test_arena_destroy_hooks_unmap) {
 	unsigned arena_ind;
 	void **ptrs;
 	unsigned nptrs;
@@ -328,8 +312,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_arena_reset,
 	    test_arena_destroy_initial,
diff --git a/test/unit/atomic.c b/test/unit/atomic.c
index 1d14368..3e36acd 100644
--- a/test/unit/atomic.c
+++ b/test/unit/atomic.c
@@ -66,8 +66,7 @@
 } while (0)
 
 TEST_STRUCT(u64, uint64_t)
-TEST_BEGIN(test_atomic_u64)
-{
+TEST_BEGIN(test_atomic_u64) {
 #if !(LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
 	test_skip("64-bit atomic operations not supported");
 #else
@@ -77,36 +76,31 @@
 TEST_END
 
 TEST_STRUCT(u32, uint32_t)
-TEST_BEGIN(test_atomic_u32)
-{
+TEST_BEGIN(test_atomic_u32) {
 	TEST_BODY(u32, uint32_t, uint32_t, u32, "#"FMTx32);
 }
 TEST_END
 
 TEST_STRUCT(p, void *)
-TEST_BEGIN(test_atomic_p)
-{
+TEST_BEGIN(test_atomic_p) {
 	TEST_BODY(p, void *, uintptr_t, ptr, "p");
 }
 TEST_END
 
 TEST_STRUCT(zu, size_t)
-TEST_BEGIN(test_atomic_zu)
-{
+TEST_BEGIN(test_atomic_zu) {
 	TEST_BODY(zu, size_t, size_t, zu, "#zx");
 }
 TEST_END
 
 TEST_STRUCT(u, unsigned)
-TEST_BEGIN(test_atomic_u)
-{
+TEST_BEGIN(test_atomic_u) {
 	TEST_BODY(u, unsigned, unsigned, u, "#x");
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_atomic_u64,
 	    test_atomic_u32,
diff --git a/test/unit/base.c b/test/unit/base.c
index 76e96da..65cf980 100644
--- a/test/unit/base.c
+++ b/test/unit/base.c
@@ -24,8 +24,7 @@
 	NULL /* merge */
 };
 
-TEST_BEGIN(test_base_hooks_default)
-{
+TEST_BEGIN(test_base_hooks_default) {
 	tsdn_t *tsdn;
 	base_t *base;
 	size_t allocated0, allocated1, resident, mapped;
@@ -52,8 +51,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_base_hooks_null)
-{
+TEST_BEGIN(test_base_hooks_null) {
 	extent_hooks_t hooks_orig;
 	tsdn_t *tsdn;
 	base_t *base;
@@ -92,8 +90,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_base_hooks_not_null)
-{
+TEST_BEGIN(test_base_hooks_not_null) {
 	extent_hooks_t hooks_orig;
 	tsdn_t *tsdn;
 	base_t *base;
@@ -214,8 +211,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_base_hooks_default,
 	    test_base_hooks_null,
diff --git a/test/unit/bitmap.c b/test/unit/bitmap.c
index b502bfe..6dfa72f 100644
--- a/test/unit/bitmap.c
+++ b/test/unit/bitmap.c
@@ -93,8 +93,7 @@
     NB(16384) \
 
 static void
-test_bitmap_initializer_body(const bitmap_info_t *binfo, size_t nbits)
-{
+test_bitmap_initializer_body(const bitmap_info_t *binfo, size_t nbits) {
 	bitmap_info_t binfo_dyn;
 	bitmap_info_init(&binfo_dyn, nbits);
 
@@ -124,8 +123,7 @@
 #endif
 }
 
-TEST_BEGIN(test_bitmap_initializer)
-{
+TEST_BEGIN(test_bitmap_initializer) {
 #define	NB(nbits) {							\
 		if (nbits <= BITMAP_MAXBITS) {				\
 			bitmap_info_t binfo =				\
@@ -140,8 +138,7 @@
 
 static size_t
 test_bitmap_size_body(const bitmap_info_t *binfo, size_t nbits,
-    size_t prev_size)
-{
+    size_t prev_size) {
 	size_t size = bitmap_size(binfo);
 	assert_zu_ge(size, (nbits >> 3),
 	    "Bitmap size is smaller than expected");
@@ -149,8 +146,7 @@
 	return (size);
 }
 
-TEST_BEGIN(test_bitmap_size)
-{
+TEST_BEGIN(test_bitmap_size) {
 	size_t nbits, prev_size;
 
 	prev_size = 0;
@@ -171,8 +167,7 @@
 TEST_END
 
 static void
-test_bitmap_init_body(const bitmap_info_t *binfo, size_t nbits)
-{
+test_bitmap_init_body(const bitmap_info_t *binfo, size_t nbits) {
 	size_t i;
 	bitmap_t *bitmap = (bitmap_t *)malloc(bitmap_size(binfo));
 	assert_ptr_not_null(bitmap, "Unexpected malloc() failure");
@@ -185,8 +180,7 @@
 	free(bitmap);
 }
 
-TEST_BEGIN(test_bitmap_init)
-{
+TEST_BEGIN(test_bitmap_init) {
 	size_t nbits;
 
 	for (nbits = 1; nbits <= BITMAP_MAXBITS; nbits++) {
@@ -204,21 +198,20 @@
 TEST_END
 
 static void
-test_bitmap_set_body(const bitmap_info_t *binfo, size_t nbits)
-{
+test_bitmap_set_body(const bitmap_info_t *binfo, size_t nbits) {
 	size_t i;
 	bitmap_t *bitmap = (bitmap_t *)malloc(bitmap_size(binfo));
 	assert_ptr_not_null(bitmap, "Unexpected malloc() failure");
 	bitmap_init(bitmap, binfo);
 
-	for (i = 0; i < nbits; i++)
+	for (i = 0; i < nbits; i++) {
 		bitmap_set(bitmap, binfo, i);
+	}
 	assert_true(bitmap_full(bitmap, binfo), "All bits should be set");
 	free(bitmap);
 }
 
-TEST_BEGIN(test_bitmap_set)
-{
+TEST_BEGIN(test_bitmap_set) {
 	size_t nbits;
 
 	for (nbits = 1; nbits <= BITMAP_MAXBITS; nbits++) {
@@ -236,26 +229,27 @@
 TEST_END
 
 static void
-test_bitmap_unset_body(const bitmap_info_t *binfo, size_t nbits)
-{
+test_bitmap_unset_body(const bitmap_info_t *binfo, size_t nbits) {
 	size_t i;
 	bitmap_t *bitmap = (bitmap_t *)malloc(bitmap_size(binfo));
 	assert_ptr_not_null(bitmap, "Unexpected malloc() failure");
 	bitmap_init(bitmap, binfo);
 
-	for (i = 0; i < nbits; i++)
+	for (i = 0; i < nbits; i++) {
 		bitmap_set(bitmap, binfo, i);
+	}
 	assert_true(bitmap_full(bitmap, binfo), "All bits should be set");
-	for (i = 0; i < nbits; i++)
+	for (i = 0; i < nbits; i++) {
 		bitmap_unset(bitmap, binfo, i);
-	for (i = 0; i < nbits; i++)
+	}
+	for (i = 0; i < nbits; i++) {
 		bitmap_set(bitmap, binfo, i);
+	}
 	assert_true(bitmap_full(bitmap, binfo), "All bits should be set");
 	free(bitmap);
 }
 
-TEST_BEGIN(test_bitmap_unset)
-{
+TEST_BEGIN(test_bitmap_unset) {
 	size_t nbits;
 
 	for (nbits = 1; nbits <= BITMAP_MAXBITS; nbits++) {
@@ -273,8 +267,7 @@
 TEST_END
 
 static void
-test_bitmap_sfu_body(const bitmap_info_t *binfo, size_t nbits)
-{
+test_bitmap_sfu_body(const bitmap_info_t *binfo, size_t nbits) {
 	size_t i;
 	bitmap_t *bitmap = (bitmap_t *)malloc(bitmap_size(binfo));
 	assert_ptr_not_null(bitmap, "Unexpected malloc() failure");
@@ -317,8 +310,7 @@
 	free(bitmap);
 }
 
-TEST_BEGIN(test_bitmap_sfu)
-{
+TEST_BEGIN(test_bitmap_sfu) {
 	size_t nbits;
 
 	for (nbits = 1; nbits <= BITMAP_MAXBITS; nbits++) {
@@ -336,8 +328,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_bitmap_initializer,
 	    test_bitmap_size,
diff --git a/test/unit/ckh.c b/test/unit/ckh.c
index 1f57668..0638cb3 100644
--- a/test/unit/ckh.c
+++ b/test/unit/ckh.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_new_delete)
-{
+TEST_BEGIN(test_new_delete) {
 	tsd_t *tsd;
 	ckh_t ckh;
 
@@ -17,8 +16,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_count_insert_search_remove)
-{
+TEST_BEGIN(test_count_insert_search_remove) {
 	tsd_t *tsd;
 	ckh_t ckh;
 	const char *strs[] = {
@@ -105,8 +103,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_insert_iter_remove)
-{
+TEST_BEGIN(test_insert_iter_remove) {
 #define	NITEMS ZU(1000)
 	tsd_t *tsd;
 	ckh_t ckh;
@@ -174,10 +171,12 @@
 				}
 			}
 
-			for (j = 0; j < i + 1; j++)
+			for (j = 0; j < i + 1; j++) {
 				assert_true(seen[j], "Item %zu not seen", j);
-			for (; j < NITEMS; j++)
+			}
+			for (; j < NITEMS; j++) {
 				assert_false(seen[j], "Item %zu seen", j);
+			}
 		}
 	}
 
@@ -204,8 +203,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_new_delete,
 	    test_count_insert_search_remove,
diff --git a/test/unit/decay.c b/test/unit/decay.c
index b3b1dd9..d6334cd 100644
--- a/test/unit/decay.c
+++ b/test/unit/decay.c
@@ -10,22 +10,20 @@
 static bool monotonic_mock;
 
 static bool
-nstime_monotonic_mock(void)
-{
+nstime_monotonic_mock(void) {
 	return (monotonic_mock);
 }
 
 static bool
-nstime_update_mock(nstime_t *time)
-{
+nstime_update_mock(nstime_t *time) {
 	nupdates_mock++;
-	if (monotonic_mock)
+	if (monotonic_mock) {
 		nstime_copy(time, &time_mock);
+	}
 	return (!monotonic_mock);
 }
 
-TEST_BEGIN(test_decay_ticks)
-{
+TEST_BEGIN(test_decay_ticks) {
 	ticker_t *decay_ticker;
 	unsigned tick0, tick1;
 	size_t sz, large0;
@@ -197,8 +195,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_decay_ticker)
-{
+TEST_BEGIN(test_decay_ticker) {
 #define	NPS 1024
 	int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
 	void *ps[NPS];
@@ -284,14 +281,14 @@
 		nstime_update(&time);
 	} while (nstime_compare(&time, &deadline) <= 0 && npurge1 == npurge0);
 
-	if (config_stats)
+	if (config_stats) {
 		assert_u64_gt(npurge1, npurge0, "Expected purging to occur");
+	}
 #undef NPS
 }
 TEST_END
 
-TEST_BEGIN(test_decay_nonmonotonic)
-{
+TEST_BEGIN(test_decay_nonmonotonic) {
 #define	NPS (SMOOTHSTEP_NSTEPS + 1)
 	int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
 	void *ps[NPS];
@@ -343,8 +340,9 @@
 	assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge1, &sz,
 	    NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
 
-	if (config_stats)
+	if (config_stats) {
 		assert_u64_eq(npurge0, npurge1, "Unexpected purging occurred");
+	}
 
 	nstime_monotonic = nstime_monotonic_orig;
 	nstime_update = nstime_update_orig;
@@ -353,8 +351,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_decay_ticks,
 	    test_decay_ticker,
diff --git a/test/unit/extent_quantize.c b/test/unit/extent_quantize.c
index a5c1b7a..343d1d8 100644
--- a/test/unit/extent_quantize.c
+++ b/test/unit/extent_quantize.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_small_extent_size)
-{
+TEST_BEGIN(test_small_extent_size) {
 	unsigned nbins, i;
 	size_t sz, extent_size;
 	size_t mib[4];
@@ -35,8 +34,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_large_extent_size)
-{
+TEST_BEGIN(test_large_extent_size) {
 	bool cache_oblivious;
 	unsigned nlextents, i;
 	size_t sz, extent_size_prev, ceil_prev;
@@ -100,8 +98,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_monotonic)
-{
+TEST_BEGIN(test_monotonic) {
 #define	SZ_MAX	ZU(4 * 1024 * 1024)
 	unsigned i;
 	size_t floor_prev, ceil_prev;
@@ -136,8 +133,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_small_extent_size,
 	    test_large_extent_size,
diff --git a/test/unit/fork.c b/test/unit/fork.c
index 58091c6..4880328 100644
--- a/test/unit/fork.c
+++ b/test/unit/fork.c
@@ -4,8 +4,7 @@
 #include <sys/wait.h>
 #endif
 
-TEST_BEGIN(test_fork)
-{
+TEST_BEGIN(test_fork) {
 #ifndef _WIN32
 	void *p;
 	pid_t pid;
@@ -32,8 +31,9 @@
 
 		/* Parent. */
 		while (true) {
-			if (waitpid(pid, &status, 0) == -1)
+			if (waitpid(pid, &status, 0) == -1) {
 				test_fail("Unexpected waitpid() failure");
+			}
 			if (WIFSIGNALED(status)) {
 				test_fail("Unexpected child termination due to "
 				    "signal %d", WTERMSIG(status));
@@ -56,8 +56,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_fork));
 }
diff --git a/test/unit/hash.c b/test/unit/hash.c
index ff23777..977d058 100644
--- a/test/unit/hash.c
+++ b/test/unit/hash.c
@@ -36,8 +36,7 @@
 } hash_variant_t;
 
 static int
-hash_variant_bits(hash_variant_t variant)
-{
+hash_variant_bits(hash_variant_t variant) {
 	switch (variant) {
 	case hash_variant_x86_32: return (32);
 	case hash_variant_x86_128: return (128);
@@ -47,8 +46,7 @@
 }
 
 static const char *
-hash_variant_string(hash_variant_t variant)
-{
+hash_variant_string(hash_variant_t variant) {
 	switch (variant) {
 	case hash_variant_x86_32: return ("hash_x86_32");
 	case hash_variant_x86_128: return ("hash_x86_128");
@@ -59,8 +57,7 @@
 
 #define	KEY_SIZE	256
 static void
-hash_variant_verify_key(hash_variant_t variant, uint8_t *key)
-{
+hash_variant_verify_key(hash_variant_t variant, uint8_t *key) {
 	const int hashbytes = hash_variant_bits(variant) / 8;
 	const int hashes_size = hashbytes * 256;
 	VARIABLE_ARRAY(uint8_t, hashes, hashes_size);
@@ -139,39 +136,35 @@
 }
 
 static void
-hash_variant_verify(hash_variant_t variant)
-{
+hash_variant_verify(hash_variant_t variant) {
 #define	MAX_ALIGN	16
 	uint8_t key[KEY_SIZE + (MAX_ALIGN - 1)];
 	unsigned i;
 
-	for (i = 0; i < MAX_ALIGN; i++)
+	for (i = 0; i < MAX_ALIGN; i++) {
 		hash_variant_verify_key(variant, &key[i]);
+	}
 #undef MAX_ALIGN
 }
 #undef KEY_SIZE
 
-TEST_BEGIN(test_hash_x86_32)
-{
+TEST_BEGIN(test_hash_x86_32) {
 	hash_variant_verify(hash_variant_x86_32);
 }
 TEST_END
 
-TEST_BEGIN(test_hash_x86_128)
-{
+TEST_BEGIN(test_hash_x86_128) {
 	hash_variant_verify(hash_variant_x86_128);
 }
 TEST_END
 
-TEST_BEGIN(test_hash_x64_128)
-{
+TEST_BEGIN(test_hash_x64_128) {
 	hash_variant_verify(hash_variant_x64_128);
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_hash_x86_32,
 	    test_hash_x86_128,
diff --git a/test/unit/junk.c b/test/unit/junk.c
index 5f34d05..02f0726 100644
--- a/test/unit/junk.c
+++ b/test/unit/junk.c
@@ -15,15 +15,13 @@
 static bool saw_junking;
 
 static void
-watch_junking(void *p)
-{
+watch_junking(void *p) {
 	watch_for_junking = p;
 	saw_junking = false;
 }
 
 static void
-arena_dalloc_junk_small_intercept(void *ptr, const arena_bin_info_t *bin_info)
-{
+arena_dalloc_junk_small_intercept(void *ptr, const arena_bin_info_t *bin_info) {
 	size_t i;
 
 	arena_dalloc_junk_small_orig(ptr, bin_info);
@@ -32,13 +30,13 @@
 		    "Missing junk fill for byte %zu/%zu of deallocated region",
 		    i, bin_info->reg_size);
 	}
-	if (ptr == watch_for_junking)
+	if (ptr == watch_for_junking) {
 		saw_junking = true;
+	}
 }
 
 static void
-large_dalloc_junk_intercept(void *ptr, size_t usize)
-{
+large_dalloc_junk_intercept(void *ptr, size_t usize) {
 	size_t i;
 
 	large_dalloc_junk_orig(ptr, usize);
@@ -47,21 +45,21 @@
 		    "Missing junk fill for byte %zu/%zu of deallocated region",
 		    i, usize);
 	}
-	if (ptr == watch_for_junking)
+	if (ptr == watch_for_junking) {
 		saw_junking = true;
+	}
 }
 
 static void
-large_dalloc_maybe_junk_intercept(void *ptr, size_t usize)
-{
+large_dalloc_maybe_junk_intercept(void *ptr, size_t usize) {
 	large_dalloc_maybe_junk_orig(ptr, usize);
-	if (ptr == watch_for_junking)
+	if (ptr == watch_for_junking) {
 		saw_junking = true;
+	}
 }
 
 static void
-test_junk(size_t sz_min, size_t sz_max)
-{
+test_junk(size_t sz_min, size_t sz_max) {
 	uint8_t *s;
 	size_t sz_prev, sz, i;
 
@@ -126,23 +124,20 @@
 	}
 }
 
-TEST_BEGIN(test_junk_small)
-{
+TEST_BEGIN(test_junk_small) {
 	test_skip_if(!config_fill);
 	test_junk(1, SMALL_MAXCLASS-1);
 }
 TEST_END
 
-TEST_BEGIN(test_junk_large)
-{
+TEST_BEGIN(test_junk_large) {
 	test_skip_if(!config_fill);
 	test_junk(SMALL_MAXCLASS+1, (1U << (LG_LARGE_MINCLASS+1)));
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_junk_small,
 	    test_junk_large));
diff --git a/test/unit/mallctl.c b/test/unit/mallctl.c
index 5b734e1..a116894 100644
--- a/test/unit/mallctl.c
+++ b/test/unit/mallctl.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_mallctl_errors)
-{
+TEST_BEGIN(test_mallctl_errors) {
 	uint64_t epoch;
 	size_t sz;
 
@@ -28,8 +27,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_mallctlnametomib_errors)
-{
+TEST_BEGIN(test_mallctlnametomib_errors) {
 	size_t mib[1];
 	size_t miblen;
 
@@ -39,8 +37,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_mallctlbymib_errors)
-{
+TEST_BEGIN(test_mallctlbymib_errors) {
 	uint64_t epoch;
 	size_t sz;
 	size_t mib[1];
@@ -76,8 +73,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_mallctl_read_write)
-{
+TEST_BEGIN(test_mallctl_read_write) {
 	uint64_t old_epoch, new_epoch;
 	size_t sz = sizeof(old_epoch);
 
@@ -104,8 +100,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_mallctlnametomib_short_mib)
-{
+TEST_BEGIN(test_mallctlnametomib_short_mib) {
 	size_t mib[4];
 	size_t miblen;
 
@@ -119,8 +114,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_mallctl_config)
-{
+TEST_BEGIN(test_mallctl_config) {
 #define	TEST_MALLCTL_CONFIG(config, t) do {				\
 	t oldval;							\
 	size_t sz = sizeof(oldval);					\
@@ -149,8 +143,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_mallctl_opt)
-{
+TEST_BEGIN(test_mallctl_opt) {
 	bool config_always = true;
 
 #define	TEST_MALLCTL_OPT(t, opt, config) do {				\
@@ -189,8 +182,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_manpage_example)
-{
+TEST_BEGIN(test_manpage_example) {
 	unsigned nbins, i;
 	size_t mib[4];
 	size_t len, miblen;
@@ -214,8 +206,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_tcache_none)
-{
+TEST_BEGIN(test_tcache_none) {
 	void *p0, *q, *p1;
 
 	test_skip_if(!config_tcache);
@@ -240,8 +231,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_tcache)
-{
+TEST_BEGIN(test_tcache) {
 #define	NTCACHES	10
 	unsigned tis[NTCACHES];
 	void *ps[NTCACHES];
@@ -312,11 +302,13 @@
 		assert_ptr_eq(qs[i], q0,
 		    "Expected rallocx() to allocate cached region, i=%u", i);
 		/* Avoid undefined behavior in case of test failure. */
-		if (qs[i] == NULL)
+		if (qs[i] == NULL) {
 			qs[i] = ps[i];
+		}
 	}
-	for (i = 0; i < NTCACHES; i++)
+	for (i = 0; i < NTCACHES; i++) {
 		dallocx(qs[i], MALLOCX_TCACHE(tis[i]));
+	}
 
 	/* Flush some non-empty tcaches. */
 	for (i = 0; i < NTCACHES/2; i++) {
@@ -334,8 +326,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_thread_arena)
-{
+TEST_BEGIN(test_thread_arena) {
 	unsigned arena_old, arena_new, narenas;
 	size_t sz = sizeof(unsigned);
 
@@ -353,8 +344,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arena_i_initialized)
-{
+TEST_BEGIN(test_arena_i_initialized) {
 	unsigned narenas, i;
 	size_t sz;
 	size_t mib[3];
@@ -392,8 +382,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arena_i_decay_time)
-{
+TEST_BEGIN(test_arena_i_decay_time) {
 	ssize_t decay_time, orig_decay_time, prev_decay_time;
 	size_t sz = sizeof(ssize_t);
 
@@ -423,8 +412,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arena_i_purge)
-{
+TEST_BEGIN(test_arena_i_purge) {
 	unsigned narenas;
 	size_t sz = sizeof(unsigned);
 	size_t mib[3];
@@ -447,8 +435,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arena_i_decay)
-{
+TEST_BEGIN(test_arena_i_decay) {
 	unsigned narenas;
 	size_t sz = sizeof(unsigned);
 	size_t mib[3];
@@ -471,8 +458,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arena_i_dss)
-{
+TEST_BEGIN(test_arena_i_dss) {
 	const char *dss_prec_old, *dss_prec_new;
 	size_t sz = sizeof(dss_prec_old);
 	size_t mib[3];
@@ -517,8 +503,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arenas_decay_time)
-{
+TEST_BEGIN(test_arenas_decay_time) {
 	ssize_t decay_time, orig_decay_time, prev_decay_time;
 	size_t sz = sizeof(ssize_t);
 
@@ -548,8 +533,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arenas_constants)
-{
+TEST_BEGIN(test_arenas_constants) {
 #define	TEST_ARENAS_CONSTANT(t, name, expected) do {			\
 	t name;								\
 	size_t sz = sizeof(t);						\
@@ -567,8 +551,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arenas_bin_constants)
-{
+TEST_BEGIN(test_arenas_bin_constants) {
 #define	TEST_ARENAS_BIN_CONSTANT(t, name, expected) do {		\
 	t name;								\
 	size_t sz = sizeof(t);						\
@@ -586,8 +569,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arenas_lextent_constants)
-{
+TEST_BEGIN(test_arenas_lextent_constants) {
 #define	TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do {		\
 	t name;								\
 	size_t sz = sizeof(t);						\
@@ -602,8 +584,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_arenas_create)
-{
+TEST_BEGIN(test_arenas_create) {
 	unsigned narenas_before, arena, narenas_after;
 	size_t sz = sizeof(unsigned);
 
@@ -620,8 +601,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_stats_arenas)
-{
+TEST_BEGIN(test_stats_arenas) {
 #define	TEST_STATS_ARENAS(t, name) do {					\
 	t name;								\
 	size_t sz = sizeof(t);						\
@@ -640,8 +620,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_mallctl_errors,
 	    test_mallctlnametomib_errors,
diff --git a/test/unit/math.c b/test/unit/math.c
index 8e5ec61..15fc7d5 100644
--- a/test/unit/math.c
+++ b/test/unit/math.c
@@ -14,30 +14,29 @@
 #endif
 
 static bool
-double_eq_rel(double a, double b, double max_rel_err, double max_abs_err)
-{
+double_eq_rel(double a, double b, double max_rel_err, double max_abs_err) {
 	double rel_err;
 
-	if (fabs(a - b) < max_abs_err)
+	if (fabs(a - b) < max_abs_err) {
 		return (true);
+	}
 	rel_err = (fabs(b) > fabs(a)) ? fabs((a-b)/b) : fabs((a-b)/a);
 	return (rel_err < max_rel_err);
 }
 
 static uint64_t
-factorial(unsigned x)
-{
+factorial(unsigned x) {
 	uint64_t ret = 1;
 	unsigned i;
 
-	for (i = 2; i <= x; i++)
+	for (i = 2; i <= x; i++) {
 		ret *= (uint64_t)i;
+	}
 
 	return (ret);
 }
 
-TEST_BEGIN(test_ln_gamma_factorial)
-{
+TEST_BEGIN(test_ln_gamma_factorial) {
 	unsigned x;
 
 	/* exp(ln_gamma(x)) == (x-1)! for integer x. */
@@ -188,8 +187,7 @@
 	359.13420536957539753
 };
 
-TEST_BEGIN(test_ln_gamma_misc)
-{
+TEST_BEGIN(test_ln_gamma_misc) {
 	unsigned i;
 
 	for (i = 1; i < sizeof(ln_gamma_misc_expected)/sizeof(double); i++) {
@@ -239,8 +237,7 @@
 	1.88079360815125041, 2.05374891063182208, 2.32634787404084076
 };
 
-TEST_BEGIN(test_pt_norm)
-{
+TEST_BEGIN(test_pt_norm) {
 	unsigned i;
 
 	for (i = 1; i < sizeof(pt_norm_expected)/sizeof(double); i++) {
@@ -289,8 +286,7 @@
 	1046.4872561869577, 1063.5717461999654, 1107.0741966053859
 };
 
-TEST_BEGIN(test_pt_chi2)
-{
+TEST_BEGIN(test_pt_chi2) {
 	unsigned i, j;
 	unsigned e = 0;
 
@@ -351,8 +347,7 @@
 	4.7230515633946677, 5.6417477865306020, 8.4059469148854635
 };
 
-TEST_BEGIN(test_pt_gamma_shape)
-{
+TEST_BEGIN(test_pt_gamma_shape) {
 	unsigned i, j;
 	unsigned e = 0;
 
@@ -371,8 +366,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_pt_gamma_scale)
-{
+TEST_BEGIN(test_pt_gamma_scale) {
 	double shape = 1.0;
 	double ln_gamma_shape = ln_gamma(shape);
 
@@ -385,8 +379,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_ln_gamma_factorial,
 	    test_ln_gamma_misc,
diff --git a/test/unit/mq.c b/test/unit/mq.c
index bd289c5..95c9c50 100644
--- a/test/unit/mq.c
+++ b/test/unit/mq.c
@@ -9,8 +9,7 @@
 };
 mq_gen(static, mq_, mq_t, mq_msg_t, link)
 
-TEST_BEGIN(test_mq_basic)
-{
+TEST_BEGIN(test_mq_basic) {
 	mq_t mq;
 	mq_msg_t msg;
 
@@ -31,8 +30,7 @@
 TEST_END
 
 static void *
-thd_receiver_start(void *arg)
-{
+thd_receiver_start(void *arg) {
 	mq_t *mq = (mq_t *)arg;
 	unsigned i;
 
@@ -45,8 +43,7 @@
 }
 
 static void *
-thd_sender_start(void *arg)
-{
+thd_sender_start(void *arg) {
 	mq_t *mq = (mq_t *)arg;
 	unsigned i;
 
@@ -61,8 +58,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_mq_threaded)
-{
+TEST_BEGIN(test_mq_threaded) {
 	mq_t mq;
 	thd_t receiver;
 	thd_t senders[NSENDERS];
@@ -71,20 +67,21 @@
 	assert_false(mq_init(&mq), "Unexpected mq_init() failure");
 
 	thd_create(&receiver, thd_receiver_start, (void *)&mq);
-	for (i = 0; i < NSENDERS; i++)
+	for (i = 0; i < NSENDERS; i++) {
 		thd_create(&senders[i], thd_sender_start, (void *)&mq);
+	}
 
 	thd_join(receiver, NULL);
-	for (i = 0; i < NSENDERS; i++)
+	for (i = 0; i < NSENDERS; i++) {
 		thd_join(senders[i], NULL);
+	}
 
 	mq_fini(&mq);
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_mq_basic,
 	    test_mq_threaded));
diff --git a/test/unit/mtx.c b/test/unit/mtx.c
index 2eccc98..0813a69 100644
--- a/test/unit/mtx.c
+++ b/test/unit/mtx.c
@@ -3,8 +3,7 @@
 #define	NTHREADS	2
 #define	NINCRS		2000000
 
-TEST_BEGIN(test_mtx_basic)
-{
+TEST_BEGIN(test_mtx_basic) {
 	mtx_t mtx;
 
 	assert_false(mtx_init(&mtx), "Unexpected mtx_init() failure");
@@ -20,8 +19,7 @@
 } thd_start_arg_t;
 
 static void *
-thd_start(void *varg)
-{
+thd_start(void *varg) {
 	thd_start_arg_t *arg = (thd_start_arg_t *)varg;
 	unsigned i;
 
@@ -33,26 +31,26 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_mtx_race)
-{
+TEST_BEGIN(test_mtx_race) {
 	thd_start_arg_t arg;
 	thd_t thds[NTHREADS];
 	unsigned i;
 
 	assert_false(mtx_init(&arg.mtx), "Unexpected mtx_init() failure");
 	arg.x = 0;
-	for (i = 0; i < NTHREADS; i++)
+	for (i = 0; i < NTHREADS; i++) {
 		thd_create(&thds[i], thd_start, (void *)&arg);
-	for (i = 0; i < NTHREADS; i++)
+	}
+	for (i = 0; i < NTHREADS; i++) {
 		thd_join(thds[i], NULL);
+	}
 	assert_u_eq(arg.x, NTHREADS * NINCRS,
 	    "Race-related counter corruption");
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_mtx_basic,
 	    test_mtx_race));
diff --git a/test/unit/nstime.c b/test/unit/nstime.c
index 6548ba2..f628a8f 100644
--- a/test/unit/nstime.c
+++ b/test/unit/nstime.c
@@ -2,8 +2,7 @@
 
 #define	BILLION	UINT64_C(1000000000)
 
-TEST_BEGIN(test_nstime_init)
-{
+TEST_BEGIN(test_nstime_init) {
 	nstime_t nst;
 
 	nstime_init(&nst, 42000000043);
@@ -13,8 +12,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_init2)
-{
+TEST_BEGIN(test_nstime_init2) {
 	nstime_t nst;
 
 	nstime_init2(&nst, 42, 43);
@@ -23,8 +21,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_copy)
-{
+TEST_BEGIN(test_nstime_copy) {
 	nstime_t nsta, nstb;
 
 	nstime_init2(&nsta, 42, 43);
@@ -35,8 +32,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_compare)
-{
+TEST_BEGIN(test_nstime_compare) {
 	nstime_t nsta, nstb;
 
 	nstime_init2(&nsta, 42, 43);
@@ -70,8 +66,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_add)
-{
+TEST_BEGIN(test_nstime_add) {
 	nstime_t nsta, nstb;
 
 	nstime_init2(&nsta, 42, 43);
@@ -90,8 +85,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_subtract)
-{
+TEST_BEGIN(test_nstime_subtract) {
 	nstime_t nsta, nstb;
 
 	nstime_init2(&nsta, 42, 43);
@@ -110,8 +104,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_imultiply)
-{
+TEST_BEGIN(test_nstime_imultiply) {
 	nstime_t nsta, nstb;
 
 	nstime_init2(&nsta, 42, 43);
@@ -128,8 +121,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_idivide)
-{
+TEST_BEGIN(test_nstime_idivide) {
 	nstime_t nsta, nstb;
 
 	nstime_init2(&nsta, 42, 43);
@@ -148,8 +140,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_divide)
-{
+TEST_BEGIN(test_nstime_divide) {
 	nstime_t nsta, nstb, nstc;
 
 	nstime_init2(&nsta, 42, 43);
@@ -176,14 +167,12 @@
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_monotonic)
-{
+TEST_BEGIN(test_nstime_monotonic) {
 	nstime_monotonic();
 }
 TEST_END
 
-TEST_BEGIN(test_nstime_update)
-{
+TEST_BEGIN(test_nstime_update) {
 	nstime_t nst;
 
 	nstime_init(&nst, 0);
@@ -208,8 +197,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_nstime_init,
 	    test_nstime_init2,
diff --git a/test/unit/pack.c b/test/unit/pack.c
index 316b6df..9237ba2 100644
--- a/test/unit/pack.c
+++ b/test/unit/pack.c
@@ -20,8 +20,7 @@
 #define	NSLABS	8
 
 static unsigned
-binind_compute(void)
-{
+binind_compute(void) {
 	size_t sz;
 	unsigned nbins, i;
 
@@ -41,8 +40,9 @@
 		sz = sizeof(size);
 		assert_d_eq(mallctlbymib(mib, miblen, (void *)&size, &sz, NULL,
 		    0), 0, "Unexpected mallctlbymib failure");
-		if (size == SZ)
+		if (size == SZ) {
 			return (i);
+		}
 	}
 
 	test_fail("Unable to compute nregs_per_run");
@@ -50,8 +50,7 @@
 }
 
 static size_t
-nregs_per_run_compute(void)
-{
+nregs_per_run_compute(void) {
 	uint32_t nregs;
 	size_t sz;
 	unsigned binind = binind_compute();
@@ -68,8 +67,7 @@
 }
 
 static unsigned
-arenas_create_mallctl(void)
-{
+arenas_create_mallctl(void) {
 	unsigned arena_ind;
 	size_t sz;
 
@@ -81,8 +79,7 @@
 }
 
 static void
-arena_reset_mallctl(unsigned arena_ind)
-{
+arena_reset_mallctl(unsigned arena_ind) {
 	size_t mib[3];
 	size_t miblen = sizeof(mib)/sizeof(size_t);
 
@@ -93,8 +90,7 @@
 	    "Unexpected mallctlbymib() failure");
 }
 
-TEST_BEGIN(test_pack)
-{
+TEST_BEGIN(test_pack) {
 	unsigned arena_ind = arenas_create_mallctl();
 	size_t nregs_per_run = nregs_per_run_compute();
 	size_t nregs = nregs_per_run * NSLABS;
@@ -125,8 +121,9 @@
 	    i++, offset = (offset + 1) % nregs_per_run) {
 		for (j = 0; j < nregs_per_run; j++) {
 			void *p = ptrs[(i * nregs_per_run) + j];
-			if (offset == j)
+			if (offset == j) {
 				continue;
+			}
 			dallocx(p, MALLOCX_ARENA(arena_ind) |
 			    MALLOCX_TCACHE_NONE);
 		}
@@ -143,8 +140,9 @@
 		for (j = 0; j < nregs_per_run; j++) {
 			void *p;
 
-			if (offset == j)
+			if (offset == j) {
 				continue;
+			}
 			p = mallocx(SZ, MALLOCX_ARENA(arena_ind) |
 			    MALLOCX_TCACHE_NONE);
 			assert_ptr_eq(p, ptrs[(i * nregs_per_run) + j],
@@ -159,8 +157,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_pack));
 }
diff --git a/test/unit/pages.c b/test/unit/pages.c
index 1e6add9..b6092de 100644
--- a/test/unit/pages.c
+++ b/test/unit/pages.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_pages_huge)
-{
+TEST_BEGIN(test_pages_huge) {
 	size_t alloc_size;
 	bool commit;
 	void *pages, *hugepage;
@@ -22,8 +21,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_pages_huge));
 }
diff --git a/test/unit/ph.c b/test/unit/ph.c
index 10bf99e..e49a0e7 100644
--- a/test/unit/ph.c
+++ b/test/unit/ph.c
@@ -10,8 +10,7 @@
 };
 
 static int
-node_cmp(const node_t *a, const node_t *b)
-{
+node_cmp(const node_t *a, const node_t *b) {
 	int ret;
 
 	ret = (a->key > b->key) - (a->key < b->key);
@@ -39,18 +38,19 @@
 ph_gen(static, heap_, heap_t, node_t, link, node_cmp_magic);
 
 static void
-node_print(const node_t *node, unsigned depth)
-{
+node_print(const node_t *node, unsigned depth) {
 	unsigned i;
 	node_t *leftmost_child, *sibling;
 
-	for (i = 0; i < depth; i++)
+	for (i = 0; i < depth; i++) {
 		malloc_printf("\t");
+	}
 	malloc_printf("%2"FMTu64"\n", node->key);
 
 	leftmost_child = phn_lchild_get(node_t, link, node);
-	if (leftmost_child == NULL)
+	if (leftmost_child == NULL) {
 		return;
+	}
 	node_print(leftmost_child, depth + 1);
 
 	for (sibling = phn_next_get(node_t, link, leftmost_child); sibling !=
@@ -60,13 +60,13 @@
 }
 
 static void
-heap_print(const heap_t *heap)
-{
+heap_print(const heap_t *heap) {
 	node_t *auxelm;
 
 	malloc_printf("vvv heap %p vvv\n", heap);
-	if (heap->ph_root == NULL)
+	if (heap->ph_root == NULL) {
 		goto label_return;
+	}
 
 	node_print(heap->ph_root, 0);
 
@@ -83,8 +83,7 @@
 }
 
 static unsigned
-node_validate(const node_t *node, const node_t *parent)
-{
+node_validate(const node_t *node, const node_t *parent) {
 	unsigned nnodes = 1;
 	node_t *leftmost_child, *sibling;
 
@@ -94,8 +93,9 @@
 	}
 
 	leftmost_child = phn_lchild_get(node_t, link, node);
-	if (leftmost_child == NULL)
+	if (leftmost_child == NULL) {
 		return (nnodes);
+	}
 	assert_ptr_eq((void *)phn_prev_get(node_t, link, leftmost_child),
 	    (void *)node, "Leftmost child does not link to node");
 	nnodes += node_validate(leftmost_child, node);
@@ -111,13 +111,13 @@
 }
 
 static unsigned
-heap_validate(const heap_t *heap)
-{
+heap_validate(const heap_t *heap) {
 	unsigned nnodes = 0;
 	node_t *auxelm;
 
-	if (heap->ph_root == NULL)
+	if (heap->ph_root == NULL) {
 		goto label_return;
+	}
 
 	nnodes += node_validate(heap->ph_root, NULL);
 
@@ -130,13 +130,13 @@
 	}
 
 label_return:
-	if (false)
+	if (false) {
 		heap_print(heap);
+	}
 	return (nnodes);
 }
 
-TEST_BEGIN(test_ph_empty)
-{
+TEST_BEGIN(test_ph_empty) {
 	heap_t heap;
 
 	heap_new(&heap);
@@ -146,23 +146,20 @@
 TEST_END
 
 static void
-node_remove(heap_t *heap, node_t *node)
-{
+node_remove(heap_t *heap, node_t *node) {
 	heap_remove(heap, node);
 
 	node->magic = 0;
 }
 
 static node_t *
-node_remove_first(heap_t *heap)
-{
+node_remove_first(heap_t *heap) {
 	node_t *node = heap_remove_first(heap);
 	node->magic = 0;
 	return (node);
 }
 
-TEST_BEGIN(test_ph_random)
-{
+TEST_BEGIN(test_ph_random) {
 #define	NNODES 25
 #define	NBAGS 250
 #define	SEED 42
@@ -177,17 +174,20 @@
 		switch (i) {
 		case 0:
 			/* Insert in order. */
-			for (j = 0; j < NNODES; j++)
+			for (j = 0; j < NNODES; j++) {
 				bag[j] = j;
+			}
 			break;
 		case 1:
 			/* Insert in reverse order. */
-			for (j = 0; j < NNODES; j++)
+			for (j = 0; j < NNODES; j++) {
 				bag[j] = NNODES - j - 1;
+			}
 			break;
 		default:
-			for (j = 0; j < NNODES; j++)
+			for (j = 0; j < NNODES; j++) {
 				bag[j] = gen_rand64_range(sfmt, NNODES);
+			}
 		}
 
 		for (j = 1; j <= NNODES; j++) {
@@ -280,8 +280,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_ph_empty,
 	    test_ph_random));
diff --git a/test/unit/prng.c b/test/unit/prng.c
index f32d82a..b26da36 100644
--- a/test/unit/prng.c
+++ b/test/unit/prng.c
@@ -1,8 +1,7 @@
 #include "test/jemalloc_test.h"
 
 static void
-test_prng_lg_range_u32(bool atomic)
-{
+test_prng_lg_range_u32(bool atomic) {
 	uint32_t sa, sb, ra, rb;
 	unsigned lg_range;
 
@@ -38,8 +37,7 @@
 }
 
 static void
-test_prng_lg_range_u64(void)
-{
+test_prng_lg_range_u64(void) {
 	uint64_t sa, sb, ra, rb;
 	unsigned lg_range;
 
@@ -75,8 +73,7 @@
 }
 
 static void
-test_prng_lg_range_zu(bool atomic)
-{
+test_prng_lg_range_zu(bool atomic) {
 	size_t sa, sb, ra, rb;
 	unsigned lg_range;
 
@@ -112,39 +109,33 @@
 	}
 }
 
-TEST_BEGIN(test_prng_lg_range_u32_nonatomic)
-{
+TEST_BEGIN(test_prng_lg_range_u32_nonatomic) {
 	test_prng_lg_range_u32(false);
 }
 TEST_END
 
-TEST_BEGIN(test_prng_lg_range_u32_atomic)
-{
+TEST_BEGIN(test_prng_lg_range_u32_atomic) {
 	test_prng_lg_range_u32(true);
 }
 TEST_END
 
-TEST_BEGIN(test_prng_lg_range_u64_nonatomic)
-{
+TEST_BEGIN(test_prng_lg_range_u64_nonatomic) {
 	test_prng_lg_range_u64();
 }
 TEST_END
 
-TEST_BEGIN(test_prng_lg_range_zu_nonatomic)
-{
+TEST_BEGIN(test_prng_lg_range_zu_nonatomic) {
 	test_prng_lg_range_zu(false);
 }
 TEST_END
 
-TEST_BEGIN(test_prng_lg_range_zu_atomic)
-{
+TEST_BEGIN(test_prng_lg_range_zu_atomic) {
 	test_prng_lg_range_zu(true);
 }
 TEST_END
 
 static void
-test_prng_range_u32(bool atomic)
-{
+test_prng_range_u32(bool atomic) {
 	uint32_t range;
 #define	MAX_RANGE	10000000
 #define	RANGE_STEP	97
@@ -164,8 +155,7 @@
 }
 
 static void
-test_prng_range_u64(void)
-{
+test_prng_range_u64(void) {
 	uint64_t range;
 #define	MAX_RANGE	10000000
 #define	RANGE_STEP	97
@@ -185,8 +175,7 @@
 }
 
 static void
-test_prng_range_zu(bool atomic)
-{
+test_prng_range_zu(bool atomic) {
 	size_t range;
 #define	MAX_RANGE	10000000
 #define	RANGE_STEP	97
@@ -205,39 +194,33 @@
 	}
 }
 
-TEST_BEGIN(test_prng_range_u32_nonatomic)
-{
+TEST_BEGIN(test_prng_range_u32_nonatomic) {
 	test_prng_range_u32(false);
 }
 TEST_END
 
-TEST_BEGIN(test_prng_range_u32_atomic)
-{
+TEST_BEGIN(test_prng_range_u32_atomic) {
 	test_prng_range_u32(true);
 }
 TEST_END
 
-TEST_BEGIN(test_prng_range_u64_nonatomic)
-{
+TEST_BEGIN(test_prng_range_u64_nonatomic) {
 	test_prng_range_u64();
 }
 TEST_END
 
-TEST_BEGIN(test_prng_range_zu_nonatomic)
-{
+TEST_BEGIN(test_prng_range_zu_nonatomic) {
 	test_prng_range_zu(false);
 }
 TEST_END
 
-TEST_BEGIN(test_prng_range_zu_atomic)
-{
+TEST_BEGIN(test_prng_range_zu_atomic) {
 	test_prng_range_zu(true);
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_prng_lg_range_u32_nonatomic,
 	    test_prng_lg_range_u32_atomic,
diff --git a/test/unit/prof_accum.c b/test/unit/prof_accum.c
index 41ebeea..bed0c9a 100644
--- a/test/unit/prof_accum.c
+++ b/test/unit/prof_accum.c
@@ -11,8 +11,7 @@
 #endif
 
 static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
+prof_dump_open_intercept(bool propagate_err, const char *filename) {
 	int fd;
 
 	fd = open("/dev/null", O_WRONLY);
@@ -22,14 +21,12 @@
 }
 
 static void *
-alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration)
-{
+alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration) {
 	return (btalloc(1, thd_ind*NALLOCS_PER_THREAD + iteration));
 }
 
 static void *
-thd_start(void *varg)
-{
+thd_start(void *varg) {
 	unsigned thd_ind = *(unsigned *)varg;
 	size_t bt_count_prev, bt_count;
 	unsigned i_prev, i;
@@ -57,8 +54,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_idump)
-{
+TEST_BEGIN(test_idump) {
 	bool active;
 	thd_t thds[NTHREADS];
 	unsigned thd_args[NTHREADS];
@@ -77,14 +73,14 @@
 		thd_args[i] = i;
 		thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
 	}
-	for (i = 0; i < NTHREADS; i++)
+	for (i = 0; i < NTHREADS; i++) {
 		thd_join(thds[i], NULL);
+	}
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_idump));
 }
diff --git a/test/unit/prof_active.c b/test/unit/prof_active.c
index d3b341d..422024f 100644
--- a/test/unit/prof_active.c
+++ b/test/unit/prof_active.c
@@ -6,8 +6,7 @@
 #endif
 
 static void
-mallctl_bool_get(const char *name, bool expected, const char *func, int line)
-{
+mallctl_bool_get(const char *name, bool expected, const char *func, int line) {
 	bool old;
 	size_t sz;
 
@@ -20,8 +19,7 @@
 
 static void
 mallctl_bool_set(const char *name, bool old_expected, bool val_new,
-    const char *func, int line)
-{
+    const char *func, int line) {
 	bool old;
 	size_t sz;
 
@@ -36,8 +34,7 @@
 
 static void
 mallctl_prof_active_get_impl(bool prof_active_old_expected, const char *func,
-    int line)
-{
+    int line) {
 	mallctl_bool_get("prof.active", prof_active_old_expected, func, line);
 }
 #define	mallctl_prof_active_get(a)					\
@@ -45,8 +42,7 @@
 
 static void
 mallctl_prof_active_set_impl(bool prof_active_old_expected,
-    bool prof_active_new, const char *func, int line)
-{
+    bool prof_active_new, const char *func, int line) {
 	mallctl_bool_set("prof.active", prof_active_old_expected,
 	    prof_active_new, func, line);
 }
@@ -55,8 +51,7 @@
 
 static void
 mallctl_thread_prof_active_get_impl(bool thread_prof_active_old_expected,
-    const char *func, int line)
-{
+    const char *func, int line) {
 	mallctl_bool_get("thread.prof.active", thread_prof_active_old_expected,
 	    func, line);
 }
@@ -65,8 +60,7 @@
 
 static void
 mallctl_thread_prof_active_set_impl(bool thread_prof_active_old_expected,
-    bool thread_prof_active_new, const char *func, int line)
-{
+    bool thread_prof_active_new, const char *func, int line) {
 	mallctl_bool_set("thread.prof.active", thread_prof_active_old_expected,
 	    thread_prof_active_new, func, line);
 }
@@ -74,8 +68,7 @@
 	mallctl_thread_prof_active_set_impl(a, b, __func__, __LINE__)
 
 static void
-prof_sampling_probe_impl(bool expect_sample, const char *func, int line)
-{
+prof_sampling_probe_impl(bool expect_sample, const char *func, int line) {
 	void *p;
 	size_t expected_backtraces = expect_sample ? 1 : 0;
 
@@ -90,8 +83,7 @@
 #define	prof_sampling_probe(a)						\
 	prof_sampling_probe_impl(a, __func__, __LINE__)
 
-TEST_BEGIN(test_prof_active)
-{
+TEST_BEGIN(test_prof_active) {
 	test_skip_if(!config_prof);
 
 	mallctl_prof_active_get(true);
@@ -124,8 +116,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_prof_active));
 }
diff --git a/test/unit/prof_gdump.c b/test/unit/prof_gdump.c
index 53f7cad..0d8ec71 100644
--- a/test/unit/prof_gdump.c
+++ b/test/unit/prof_gdump.c
@@ -7,8 +7,7 @@
 static bool did_prof_dump_open;
 
 static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
+prof_dump_open_intercept(bool propagate_err, const char *filename) {
 	int fd;
 
 	did_prof_dump_open = true;
@@ -19,8 +18,7 @@
 	return (fd);
 }
 
-TEST_BEGIN(test_gdump)
-{
+TEST_BEGIN(test_gdump) {
 	bool active, gdump, gdump_old;
 	void *p, *q, *r, *s;
 	size_t sz;
@@ -74,8 +72,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_gdump));
 }
diff --git a/test/unit/prof_idump.c b/test/unit/prof_idump.c
index 43824c6..393211e 100644
--- a/test/unit/prof_idump.c
+++ b/test/unit/prof_idump.c
@@ -16,8 +16,7 @@
 static bool did_prof_dump_open;
 
 static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
+prof_dump_open_intercept(bool propagate_err, const char *filename) {
 	int fd;
 
 	did_prof_dump_open = true;
@@ -28,8 +27,7 @@
 	return (fd);
 }
 
-TEST_BEGIN(test_idump)
-{
+TEST_BEGIN(test_idump) {
 	bool active;
 	void *p;
 
@@ -51,8 +49,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_idump));
 }
diff --git a/test/unit/prof_reset.c b/test/unit/prof_reset.c
index cc13e37..463f689 100644
--- a/test/unit/prof_reset.c
+++ b/test/unit/prof_reset.c
@@ -6,8 +6,7 @@
 #endif
 
 static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
+prof_dump_open_intercept(bool propagate_err, const char *filename) {
 	int fd;
 
 	fd = open("/dev/null", O_WRONLY);
@@ -17,15 +16,13 @@
 }
 
 static void
-set_prof_active(bool active)
-{
+set_prof_active(bool active) {
 	assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active,
 	    sizeof(active)), 0, "Unexpected mallctl failure");
 }
 
 static size_t
-get_lg_prof_sample(void)
-{
+get_lg_prof_sample(void) {
 	size_t lg_prof_sample;
 	size_t sz = sizeof(size_t);
 
@@ -36,8 +33,7 @@
 }
 
 static void
-do_prof_reset(size_t lg_prof_sample)
-{
+do_prof_reset(size_t lg_prof_sample) {
 	assert_d_eq(mallctl("prof.reset", NULL, NULL,
 	    (void *)&lg_prof_sample, sizeof(size_t)), 0,
 	    "Unexpected mallctl failure while resetting profile data");
@@ -45,8 +41,7 @@
 	    "Expected profile sample rate change");
 }
 
-TEST_BEGIN(test_prof_reset_basic)
-{
+TEST_BEGIN(test_prof_reset_basic) {
 	size_t lg_prof_sample_orig, lg_prof_sample, lg_prof_sample_next;
 	size_t sz;
 	unsigned i;
@@ -95,16 +90,14 @@
 prof_cnt_t cnt_all_copy = {0, 0, 0, 0};
 static bool
 prof_dump_header_intercept(tsdn_t *tsdn, bool propagate_err,
-    const prof_cnt_t *cnt_all)
-{
+    const prof_cnt_t *cnt_all) {
 	prof_dump_header_intercepted = true;
 	memcpy(&cnt_all_copy, cnt_all, sizeof(prof_cnt_t));
 
 	return (false);
 }
 
-TEST_BEGIN(test_prof_reset_cleanup)
-{
+TEST_BEGIN(test_prof_reset_cleanup) {
 	void *p;
 	prof_dump_header_t *prof_dump_header_orig;
 
@@ -148,8 +141,7 @@
 #define	RESET_INTERVAL		(1U << 10)
 #define	DUMP_INTERVAL		3677
 static void *
-thd_start(void *varg)
-{
+thd_start(void *varg) {
 	unsigned thd_ind = *(unsigned *)varg;
 	unsigned i;
 	void *objs[OBJ_RING_BUF_COUNT];
@@ -192,8 +184,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_prof_reset)
-{
+TEST_BEGIN(test_prof_reset) {
 	size_t lg_prof_sample_orig;
 	thd_t thds[NTHREADS];
 	unsigned thd_args[NTHREADS];
@@ -216,8 +207,9 @@
 		thd_args[i] = i;
 		thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
 	}
-	for (i = 0; i < NTHREADS; i++)
+	for (i = 0; i < NTHREADS; i++) {
 		thd_join(thds[i], NULL);
+	}
 
 	assert_zu_eq(prof_bt_count(), bt_count,
 	    "Unexpected bactrace count change");
@@ -237,8 +229,7 @@
 
 /* Test sampling at the same allocation site across resets. */
 #define	NITER 10
-TEST_BEGIN(test_xallocx)
-{
+TEST_BEGIN(test_xallocx) {
 	size_t lg_prof_sample_orig;
 	unsigned i;
 	void *ptrs[NITER];
@@ -288,8 +279,7 @@
 #undef NITER
 
 int
-main(void)
-{
+main(void) {
 	/* Intercept dumping prior to running any tests. */
 	prof_dump_open = prof_dump_open_intercept;
 
diff --git a/test/unit/prof_tctx.c b/test/unit/prof_tctx.c
index 8f928eb..2e35b7e 100644
--- a/test/unit/prof_tctx.c
+++ b/test/unit/prof_tctx.c
@@ -4,8 +4,7 @@
 const char *malloc_conf = "prof:true,lg_prof_sample:0";
 #endif
 
-TEST_BEGIN(test_prof_realloc)
-{
+TEST_BEGIN(test_prof_realloc) {
 	tsdn_t *tsdn;
 	int flags;
 	void *p, *q;
@@ -50,8 +49,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return test(
 	    test_prof_realloc);
 }
diff --git a/test/unit/prof_thread_name.c b/test/unit/prof_thread_name.c
index 8699936..ba86e10 100644
--- a/test/unit/prof_thread_name.c
+++ b/test/unit/prof_thread_name.c
@@ -6,8 +6,7 @@
 
 static void
 mallctl_thread_name_get_impl(const char *thread_name_expected, const char *func,
-    int line)
-{
+    int line) {
 	const char *thread_name_old;
 	size_t sz;
 
@@ -24,8 +23,7 @@
 
 static void
 mallctl_thread_name_set_impl(const char *thread_name, const char *func,
-    int line)
-{
+    int line) {
 	assert_d_eq(mallctl("thread.prof.name", NULL, NULL,
 	    (void *)&thread_name, sizeof(thread_name)), 0,
 	    "%s():%d: Unexpected mallctl failure reading thread.prof.name",
@@ -35,8 +33,7 @@
 #define	mallctl_thread_name_set(a)					\
 	mallctl_thread_name_set_impl(a, __func__, __LINE__)
 
-TEST_BEGIN(test_prof_thread_name_validation)
-{
+TEST_BEGIN(test_prof_thread_name_validation) {
 	const char *thread_name;
 
 	test_skip_if(!config_prof);
@@ -78,8 +75,7 @@
 #define	NTHREADS	4
 #define	NRESET		25
 static void *
-thd_start(void *varg)
-{
+thd_start(void *varg) {
 	unsigned thd_ind = *(unsigned *)varg;
 	char thread_name[16] = "";
 	unsigned i;
@@ -101,8 +97,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_prof_thread_name_threaded)
-{
+TEST_BEGIN(test_prof_thread_name_threaded) {
 	thd_t thds[NTHREADS];
 	unsigned thd_args[NTHREADS];
 	unsigned i;
@@ -113,16 +108,16 @@
 		thd_args[i] = i;
 		thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
 	}
-	for (i = 0; i < NTHREADS; i++)
+	for (i = 0; i < NTHREADS; i++) {
 		thd_join(thds[i], NULL);
+	}
 }
 TEST_END
 #undef NTHREADS
 #undef NRESET
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_prof_thread_name_validation,
 	    test_prof_thread_name_threaded));
diff --git a/test/unit/ql.c b/test/unit/ql.c
index 2ebb450..0bb896c 100644
--- a/test/unit/ql.c
+++ b/test/unit/ql.c
@@ -12,8 +12,7 @@
 };
 
 static void
-test_empty_list(list_head_t *head)
-{
+test_empty_list(list_head_t *head) {
 	list_t *t;
 	unsigned i;
 
@@ -34,8 +33,7 @@
 	assert_u_eq(i, 0, "Unexpected element for empty list");
 }
 
-TEST_BEGIN(test_ql_empty)
-{
+TEST_BEGIN(test_ql_empty) {
 	list_head_t head;
 
 	ql_new(&head);
@@ -44,8 +42,7 @@
 TEST_END
 
 static void
-init_entries(list_t *entries, unsigned nentries)
-{
+init_entries(list_t *entries, unsigned nentries) {
 	unsigned i;
 
 	for (i = 0; i < nentries; i++) {
@@ -55,8 +52,7 @@
 }
 
 static void
-test_entries_list(list_head_t *head, list_t *entries, unsigned nentries)
-{
+test_entries_list(list_head_t *head, list_t *entries, unsigned nentries) {
 	list_t *t;
 	unsigned i;
 
@@ -91,31 +87,31 @@
 	}
 }
 
-TEST_BEGIN(test_ql_tail_insert)
-{
+TEST_BEGIN(test_ql_tail_insert) {
 	list_head_t head;
 	list_t entries[NENTRIES];
 	unsigned i;
 
 	ql_new(&head);
 	init_entries(entries, sizeof(entries)/sizeof(list_t));
-	for (i = 0; i < NENTRIES; i++)
+	for (i = 0; i < NENTRIES; i++) {
 		ql_tail_insert(&head, &entries[i], link);
+	}
 
 	test_entries_list(&head, entries, NENTRIES);
 }
 TEST_END
 
-TEST_BEGIN(test_ql_tail_remove)
-{
+TEST_BEGIN(test_ql_tail_remove) {
 	list_head_t head;
 	list_t entries[NENTRIES];
 	unsigned i;
 
 	ql_new(&head);
 	init_entries(entries, sizeof(entries)/sizeof(list_t));
-	for (i = 0; i < NENTRIES; i++)
+	for (i = 0; i < NENTRIES; i++) {
 		ql_tail_insert(&head, &entries[i], link);
+	}
 
 	for (i = 0; i < NENTRIES; i++) {
 		test_entries_list(&head, entries, NENTRIES-i);
@@ -125,31 +121,31 @@
 }
 TEST_END
 
-TEST_BEGIN(test_ql_head_insert)
-{
+TEST_BEGIN(test_ql_head_insert) {
 	list_head_t head;
 	list_t entries[NENTRIES];
 	unsigned i;
 
 	ql_new(&head);
 	init_entries(entries, sizeof(entries)/sizeof(list_t));
-	for (i = 0; i < NENTRIES; i++)
+	for (i = 0; i < NENTRIES; i++) {
 		ql_head_insert(&head, &entries[NENTRIES-i-1], link);
+	}
 
 	test_entries_list(&head, entries, NENTRIES);
 }
 TEST_END
 
-TEST_BEGIN(test_ql_head_remove)
-{
+TEST_BEGIN(test_ql_head_remove) {
 	list_head_t head;
 	list_t entries[NENTRIES];
 	unsigned i;
 
 	ql_new(&head);
 	init_entries(entries, sizeof(entries)/sizeof(list_t));
-	for (i = 0; i < NENTRIES; i++)
+	for (i = 0; i < NENTRIES; i++) {
 		ql_head_insert(&head, &entries[NENTRIES-i-1], link);
+	}
 
 	for (i = 0; i < NENTRIES; i++) {
 		test_entries_list(&head, &entries[i], NENTRIES-i);
@@ -159,8 +155,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_ql_insert)
-{
+TEST_BEGIN(test_ql_insert) {
 	list_head_t head;
 	list_t entries[8];
 	list_t *a, *b, *c, *d, *e, *f, *g, *h;
@@ -196,8 +191,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_ql_empty,
 	    test_ql_tail_insert,
diff --git a/test/unit/qr.c b/test/unit/qr.c
index 7c9c102..8061a34 100644
--- a/test/unit/qr.c
+++ b/test/unit/qr.c
@@ -13,8 +13,7 @@
 };
 
 static void
-init_entries(ring_t *entries)
-{
+init_entries(ring_t *entries) {
 	unsigned i;
 
 	for (i = 0; i < NENTRIES; i++) {
@@ -24,8 +23,7 @@
 }
 
 static void
-test_independent_entries(ring_t *entries)
-{
+test_independent_entries(ring_t *entries) {
 	ring_t *t;
 	unsigned i, j;
 
@@ -61,8 +59,7 @@
 	}
 }
 
-TEST_BEGIN(test_qr_one)
-{
+TEST_BEGIN(test_qr_one) {
 	ring_t entries[NENTRIES];
 
 	init_entries(entries);
@@ -71,8 +68,7 @@
 TEST_END
 
 static void
-test_entries_ring(ring_t *entries)
-{
+test_entries_ring(ring_t *entries) {
 	ring_t *t;
 	unsigned i, j;
 
@@ -104,27 +100,27 @@
 	}
 }
 
-TEST_BEGIN(test_qr_after_insert)
-{
+TEST_BEGIN(test_qr_after_insert) {
 	ring_t entries[NENTRIES];
 	unsigned i;
 
 	init_entries(entries);
-	for (i = 1; i < NENTRIES; i++)
+	for (i = 1; i < NENTRIES; i++) {
 		qr_after_insert(&entries[i - 1], &entries[i], link);
+	}
 	test_entries_ring(entries);
 }
 TEST_END
 
-TEST_BEGIN(test_qr_remove)
-{
+TEST_BEGIN(test_qr_remove) {
 	ring_t entries[NENTRIES];
 	ring_t *t;
 	unsigned i, j;
 
 	init_entries(entries);
-	for (i = 1; i < NENTRIES; i++)
+	for (i = 1; i < NENTRIES; i++) {
 		qr_after_insert(&entries[i - 1], &entries[i], link);
+	}
 
 	for (i = 0; i < NENTRIES; i++) {
 		j = 0;
@@ -145,15 +141,15 @@
 }
 TEST_END
 
-TEST_BEGIN(test_qr_before_insert)
-{
+TEST_BEGIN(test_qr_before_insert) {
 	ring_t entries[NENTRIES];
 	ring_t *t;
 	unsigned i, j;
 
 	init_entries(entries);
-	for (i = 1; i < NENTRIES; i++)
+	for (i = 1; i < NENTRIES; i++) {
 		qr_before_insert(&entries[i - 1], &entries[i], link);
+	}
 	for (i = 0; i < NENTRIES; i++) {
 		j = 0;
 		qr_foreach(t, &entries[i], link) {
@@ -184,8 +180,7 @@
 TEST_END
 
 static void
-test_split_entries(ring_t *entries)
-{
+test_split_entries(ring_t *entries) {
 	ring_t *t;
 	unsigned i, j;
 
@@ -206,14 +201,14 @@
 	}
 }
 
-TEST_BEGIN(test_qr_meld_split)
-{
+TEST_BEGIN(test_qr_meld_split) {
 	ring_t entries[NENTRIES];
 	unsigned i;
 
 	init_entries(entries);
-	for (i = 1; i < NENTRIES; i++)
+	for (i = 1; i < NENTRIES; i++) {
 		qr_after_insert(&entries[i - 1], &entries[i], link);
+	}
 
 	qr_split(&entries[0], &entries[SPLIT_INDEX], ring_t, link);
 	test_split_entries(entries);
@@ -236,8 +231,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_qr_one,
 	    test_qr_after_insert,
diff --git a/test/unit/rb.c b/test/unit/rb.c
index 56e0021..dea86c6 100644
--- a/test/unit/rb.c
+++ b/test/unit/rb.c
@@ -1,14 +1,14 @@
 #include "test/jemalloc_test.h"
 
 #define	rbtn_black_height(a_type, a_field, a_rbt, r_height) do {	\
-    a_type *rbp_bh_t;							\
-    for (rbp_bh_t = (a_rbt)->rbt_root, (r_height) = 0;			\
-	 rbp_bh_t != NULL;						\
-      rbp_bh_t = rbtn_left_get(a_type, a_field, rbp_bh_t)) {		\
-	if (!rbtn_red_get(a_type, a_field, rbp_bh_t)) {			\
-	    (r_height)++;						\
+	a_type *rbp_bh_t;						\
+	for (rbp_bh_t = (a_rbt)->rbt_root, (r_height) = 0; rbp_bh_t !=	\
+	    NULL; rbp_bh_t = rbtn_left_get(a_type, a_field,		\
+	    rbp_bh_t)) {						\
+		if (!rbtn_red_get(a_type, a_field, rbp_bh_t)) {		\
+		(r_height)++;						\
+		}							\
 	}								\
-    }									\
 } while (0)
 
 typedef struct node_s node_t;
@@ -42,8 +42,7 @@
 typedef rb_tree(node_t) tree_t;
 rb_gen(static, tree_, tree_t, node_t, link, node_cmp);
 
-TEST_BEGIN(test_rb_empty)
-{
+TEST_BEGIN(test_rb_empty) {
 	tree_t tree;
 	node_t key;
 
@@ -68,52 +67,56 @@
 TEST_END
 
 static unsigned
-tree_recurse(node_t *node, unsigned black_height, unsigned black_depth)
-{
+tree_recurse(node_t *node, unsigned black_height, unsigned black_depth) {
 	unsigned ret = 0;
 	node_t *left_node;
 	node_t *right_node;
 
-	if (node == NULL)
+	if (node == NULL) {
 		return (ret);
+	}
 
 	left_node = rbtn_left_get(node_t, link, node);
 	right_node = rbtn_right_get(node_t, link, node);
 
-	if (!rbtn_red_get(node_t, link, node))
+	if (!rbtn_red_get(node_t, link, node)) {
 		black_depth++;
+	}
 
 	/* Red nodes must be interleaved with black nodes. */
 	if (rbtn_red_get(node_t, link, node)) {
-		if (left_node != NULL)
+		if (left_node != NULL) {
 			assert_false(rbtn_red_get(node_t, link, left_node),
 				"Node should be black");
-		if (right_node != NULL)
+		}
+		if (right_node != NULL) {
 			assert_false(rbtn_red_get(node_t, link, right_node),
 			    "Node should be black");
+		}
 	}
 
 	/* Self. */
 	assert_u32_eq(node->magic, NODE_MAGIC, "Bad magic");
 
 	/* Left subtree. */
-	if (left_node != NULL)
+	if (left_node != NULL) {
 		ret += tree_recurse(left_node, black_height, black_depth);
-	else
+	} else {
 		ret += (black_depth != black_height);
+	}
 
 	/* Right subtree. */
-	if (right_node != NULL)
+	if (right_node != NULL) {
 		ret += tree_recurse(right_node, black_height, black_depth);
-	else
+	} else {
 		ret += (black_depth != black_height);
+	}
 
 	return (ret);
 }
 
 static node_t *
-tree_iterate_cb(tree_t *tree, node_t *node, void *data)
-{
+tree_iterate_cb(tree_t *tree, node_t *node, void *data) {
 	unsigned *i = (unsigned *)data;
 	node_t *search_node;
 
@@ -140,8 +143,7 @@
 }
 
 static unsigned
-tree_iterate(tree_t *tree)
-{
+tree_iterate(tree_t *tree) {
 	unsigned i;
 
 	i = 0;
@@ -151,8 +153,7 @@
 }
 
 static unsigned
-tree_iterate_reverse(tree_t *tree)
-{
+tree_iterate_reverse(tree_t *tree) {
 	unsigned i;
 
 	i = 0;
@@ -162,8 +163,7 @@
 }
 
 static void
-node_remove(tree_t *tree, node_t *node, unsigned nnodes)
-{
+node_remove(tree_t *tree, node_t *node, unsigned nnodes) {
 	node_t *search_node;
 	unsigned black_height, imbalances;
 
@@ -195,8 +195,7 @@
 }
 
 static node_t *
-remove_iterate_cb(tree_t *tree, node_t *node, void *data)
-{
+remove_iterate_cb(tree_t *tree, node_t *node, void *data) {
 	unsigned *nnodes = (unsigned *)data;
 	node_t *ret = tree_next(tree, node);
 
@@ -206,8 +205,7 @@
 }
 
 static node_t *
-remove_reverse_iterate_cb(tree_t *tree, node_t *node, void *data)
-{
+remove_reverse_iterate_cb(tree_t *tree, node_t *node, void *data) {
 	unsigned *nnodes = (unsigned *)data;
 	node_t *ret = tree_prev(tree, node);
 
@@ -217,16 +215,14 @@
 }
 
 static void
-destroy_cb(node_t *node, void *data)
-{
+destroy_cb(node_t *node, void *data) {
 	unsigned *nnodes = (unsigned *)data;
 
 	assert_u_gt(*nnodes, 0, "Destruction removed too many nodes");
 	(*nnodes)--;
 }
 
-TEST_BEGIN(test_rb_random)
-{
+TEST_BEGIN(test_rb_random) {
 #define	NNODES 25
 #define	NBAGS 250
 #define	SEED 42
@@ -241,17 +237,20 @@
 		switch (i) {
 		case 0:
 			/* Insert in order. */
-			for (j = 0; j < NNODES; j++)
+			for (j = 0; j < NNODES; j++) {
 				bag[j] = j;
+			}
 			break;
 		case 1:
 			/* Insert in reverse order. */
-			for (j = 0; j < NNODES; j++)
+			for (j = 0; j < NNODES; j++) {
 				bag[j] = NNODES - j - 1;
+			}
 			break;
 		default:
-			for (j = 0; j < NNODES; j++)
+			for (j = 0; j < NNODES; j++) {
 				bag[j] = gen_rand64_range(sfmt, NNODES);
+			}
 		}
 
 		for (j = 1; j <= NNODES; j++) {
@@ -292,12 +291,14 @@
 			/* Remove nodes. */
 			switch (i % 5) {
 			case 0:
-				for (k = 0; k < j; k++)
+				for (k = 0; k < j; k++) {
 					node_remove(&tree, &nodes[k], j - k);
+				}
 				break;
 			case 1:
-				for (k = j; k > 0; k--)
+				for (k = j; k > 0; k--) {
 					node_remove(&tree, &nodes[k-1], k);
+				}
 				break;
 			case 2: {
 				node_t *start;
@@ -345,8 +346,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_rb_empty,
 	    test_rb_random));
diff --git a/test/unit/rtree.c b/test/unit/rtree.c
index d2f3705..ca99f8a 100644
--- a/test/unit/rtree.c
+++ b/test/unit/rtree.c
@@ -6,12 +6,12 @@
 rtree_t *test_rtree;
 
 static rtree_elm_t *
-rtree_node_alloc_intercept(tsdn_t *tsdn, rtree_t *rtree, size_t nelms)
-{
+rtree_node_alloc_intercept(tsdn_t *tsdn, rtree_t *rtree, size_t nelms) {
 	rtree_elm_t *node;
 
-	if (rtree != test_rtree)
+	if (rtree != test_rtree) {
 		return rtree_node_alloc_orig(tsdn, rtree, nelms);
+	}
 
 	malloc_mutex_unlock(tsdn, &rtree->init_lock);
 	node = (rtree_elm_t *)calloc(nelms, sizeof(rtree_elm_t));
@@ -22,8 +22,7 @@
 }
 
 static void
-rtree_node_dalloc_intercept(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node)
-{
+rtree_node_dalloc_intercept(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node) {
 	if (rtree != test_rtree) {
 		rtree_node_dalloc_orig(tsdn, rtree, node);
 		return;
@@ -32,8 +31,7 @@
 	free(node);
 }
 
-TEST_BEGIN(test_rtree_read_empty)
-{
+TEST_BEGIN(test_rtree_read_empty) {
 	tsdn_t *tsdn;
 	unsigned i;
 
@@ -65,8 +63,7 @@
 } thd_start_arg_t;
 
 static void *
-thd_start(void *varg)
-{
+thd_start(void *varg) {
 	thd_start_arg_t *arg = (thd_start_arg_t *)varg;
 	rtree_ctx_t rtree_ctx = RTREE_CTX_INITIALIZER;
 	sfmt_t *sfmt;
@@ -98,8 +95,9 @@
 			    "Unexpected rtree_elm_acquire() failure");
 			rtree_elm_read_acquired(tsdn, &arg->rtree, elm);
 			rtree_elm_release(tsdn, &arg->rtree, elm);
-		} else
+		} else {
 			rtree_read(tsdn, &arg->rtree, &rtree_ctx, key, false);
+		}
 	}
 
 	free(extent);
@@ -107,8 +105,7 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_rtree_concurrent)
-{
+TEST_BEGIN(test_rtree_concurrent) {
 	thd_start_arg_t arg;
 	thd_t thds[NTHREADS];
 	sfmt_t *sfmt;
@@ -123,10 +120,12 @@
 		assert_false(rtree_new(&arg.rtree, arg.nbits),
 		    "Unexpected rtree_new() failure");
 		arg.seed = gen_rand32(sfmt);
-		for (j = 0; j < NTHREADS; j++)
+		for (j = 0; j < NTHREADS; j++) {
 			thd_create(&thds[j], thd_start, (void *)&arg);
-		for (j = 0; j < NTHREADS; j++)
+		}
+		for (j = 0; j < NTHREADS; j++) {
 			thd_join(thds[j], NULL);
+		}
 		rtree_delete(tsdn, &arg.rtree);
 		test_rtree = NULL;
 	}
@@ -139,8 +138,7 @@
 #undef NITERS
 #undef SEED
 
-TEST_BEGIN(test_rtree_extrema)
-{
+TEST_BEGIN(test_rtree_extrema) {
 	unsigned i;
 	extent_t extent_a, extent_b;
 	tsdn_t *tsdn;
@@ -173,8 +171,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_rtree_bits)
-{
+TEST_BEGIN(test_rtree_bits) {
 	tsdn_t *tsdn;
 	unsigned i, j, k;
 
@@ -217,8 +214,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_rtree_random)
-{
+TEST_BEGIN(test_rtree_random) {
 	unsigned i;
 	sfmt_t *sfmt;
 	tsdn_t *tsdn;
@@ -280,8 +276,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	rtree_node_alloc_orig = rtree_node_alloc;
 	rtree_node_alloc = rtree_node_alloc_intercept;
 	rtree_node_dalloc_orig = rtree_node_dalloc;
diff --git a/test/unit/size_classes.c b/test/unit/size_classes.c
index f7c14bc..38ea9be 100644
--- a/test/unit/size_classes.c
+++ b/test/unit/size_classes.c
@@ -1,8 +1,7 @@
 #include "test/jemalloc_test.h"
 
 static size_t
-get_max_size_class(void)
-{
+get_max_size_class(void) {
 	unsigned nlextents;
 	size_t mib[4];
 	size_t sz, miblen, max_size_class;
@@ -23,8 +22,7 @@
 	return (max_size_class);
 }
 
-TEST_BEGIN(test_size_classes)
-{
+TEST_BEGIN(test_size_classes) {
 	size_t size_class, max_size_class;
 	szind_t index, max_index;
 
@@ -80,8 +78,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_psize_classes)
-{
+TEST_BEGIN(test_psize_classes) {
 	size_t size_class, max_psz;
 	pszind_t pind, max_pind;
 
@@ -136,8 +133,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_overflow)
-{
+TEST_BEGIN(test_overflow) {
 	size_t max_size_class, max_psz;
 
 	max_size_class = get_max_size_class();
@@ -176,8 +172,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_size_classes,
 	    test_psize_classes,
diff --git a/test/unit/slab.c b/test/unit/slab.c
index 7e6a62f..a5036f5 100644
--- a/test/unit/slab.c
+++ b/test/unit/slab.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_arena_slab_regind)
-{
+TEST_BEGIN(test_arena_slab_regind) {
 	szind_t binind;
 
 	for (binind = 0; binind < NBINS; binind++) {
@@ -27,8 +26,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_arena_slab_regind));
 }
diff --git a/test/unit/smoothstep.c b/test/unit/smoothstep.c
index 071aede..ac27915 100644
--- a/test/unit/smoothstep.c
+++ b/test/unit/smoothstep.c
@@ -7,8 +7,7 @@
 #undef STEP
 };
 
-TEST_BEGIN(test_smoothstep_integral)
-{
+TEST_BEGIN(test_smoothstep_integral) {
 	uint64_t sum, min, max;
 	unsigned i;
 
@@ -20,8 +19,9 @@
 	 * integral may be off by as much as SMOOTHSTEP_NSTEPS ulps.
 	 */
 	sum = 0;
-	for (i = 0; i < SMOOTHSTEP_NSTEPS; i++)
+	for (i = 0; i < SMOOTHSTEP_NSTEPS; i++) {
 		sum += smoothstep_tab[i];
+	}
 
 	max = (KQU(1) << (SMOOTHSTEP_BFP-1)) * (SMOOTHSTEP_NSTEPS+1);
 	min = max - SMOOTHSTEP_NSTEPS;
@@ -36,8 +36,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_smoothstep_monotonic)
-{
+TEST_BEGIN(test_smoothstep_monotonic) {
 	uint64_t prev_h;
 	unsigned i;
 
@@ -58,8 +57,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_smoothstep_slope)
-{
+TEST_BEGIN(test_smoothstep_slope) {
 	uint64_t prev_h, prev_delta;
 	unsigned i;
 
@@ -96,8 +94,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_smoothstep_integral,
 	    test_smoothstep_monotonic,
diff --git a/test/unit/stats.c b/test/unit/stats.c
index 18856f1..98673a8 100644
--- a/test/unit/stats.c
+++ b/test/unit/stats.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_stats_summary)
-{
+TEST_BEGIN(test_stats_summary) {
 	size_t sz, allocated, active, resident, mapped;
 	int expected = config_stats ? 0 : ENOENT;
 
@@ -26,8 +25,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_stats_large)
-{
+TEST_BEGIN(test_stats_large) {
 	void *p;
 	uint64_t epoch;
 	size_t allocated;
@@ -67,8 +65,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_stats_arenas_summary)
-{
+TEST_BEGIN(test_stats_arenas_summary) {
 	unsigned arena;
 	void *little, *large;
 	uint64_t epoch;
@@ -118,22 +115,19 @@
 TEST_END
 
 void *
-thd_start(void *arg)
-{
+thd_start(void *arg) {
 	return (NULL);
 }
 
 static void
-no_lazy_lock(void)
-{
+no_lazy_lock(void) {
 	thd_t thd;
 
 	thd_create(&thd, thd_start, NULL);
 	thd_join(thd, NULL);
 }
 
-TEST_BEGIN(test_stats_arenas_small)
-{
+TEST_BEGIN(test_stats_arenas_small) {
 	unsigned arena;
 	void *p;
 	size_t sz, allocated;
@@ -183,8 +177,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_stats_arenas_large)
-{
+TEST_BEGIN(test_stats_arenas_large) {
 	unsigned arena;
 	void *p;
 	size_t sz, allocated;
@@ -224,8 +217,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_stats_arenas_bins)
-{
+TEST_BEGIN(test_stats_arenas_bins) {
 	unsigned arena;
 	void *p;
 	size_t sz, curslabs, curregs;
@@ -299,8 +291,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_stats_arenas_lextents)
-{
+TEST_BEGIN(test_stats_arenas_lextents) {
 	unsigned arena;
 	void *p;
 	uint64_t epoch, nmalloc, ndalloc;
@@ -347,8 +338,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_stats_summary,
 	    test_stats_large,
diff --git a/test/unit/stats_print.c b/test/unit/stats_print.c
index 5accd8e..1fb8fe6 100644
--- a/test/unit/stats_print.c
+++ b/test/unit/stats_print.c
@@ -39,8 +39,7 @@
 
 static void
 token_init(token_t *token, parser_t *parser, token_type_t token_type,
-    size_t pos, size_t len, size_t line, size_t col)
-{
+    size_t pos, size_t len, size_t line, size_t col) {
 	token->parser = parser;
 	token->token_type = token_type;
 	token->pos = pos;
@@ -50,8 +49,7 @@
 }
 
 static void
-token_error(token_t *token)
-{
+token_error(token_t *token) {
 	if (!token->parser->verbose) {
 		return;
 	}
@@ -72,8 +70,7 @@
 }
 
 static void
-parser_init(parser_t *parser, bool verbose)
-{
+parser_init(parser_t *parser, bool verbose) {
 	parser->verbose = verbose;
 	parser->buf = NULL;
 	parser->len = 0;
@@ -83,16 +80,14 @@
 }
 
 static void
-parser_fini(parser_t *parser)
-{
+parser_fini(parser_t *parser) {
 	if (parser->buf != NULL) {
 		dallocx(parser->buf, MALLOCX_TCACHE_NONE);
 	}
 }
 
 static bool
-parser_append(parser_t *parser, const char *str)
-{
+parser_append(parser_t *parser, const char *str) {
 	size_t len = strlen(str);
 	char *buf = (parser->buf == NULL) ? mallocx(len + 1,
 	    MALLOCX_TCACHE_NONE) : rallocx(parser->buf, parser->len + len + 1,
@@ -107,8 +102,7 @@
 }
 
 static bool
-parser_tokenize(parser_t *parser)
-{
+parser_tokenize(parser_t *parser) {
 	enum {
 		STATE_START,
 		STATE_EOI,
@@ -667,8 +661,7 @@
 static bool	parser_parse_object(parser_t *parser);
 
 static bool
-parser_parse_value(parser_t *parser)
-{
+parser_parse_value(parser_t *parser) {
 	switch (parser->token.token_type) {
 	case TOKEN_TYPE_NULL:
 	case TOKEN_TYPE_FALSE:
@@ -687,8 +680,7 @@
 }
 
 static bool
-parser_parse_pair(parser_t *parser)
-{
+parser_parse_pair(parser_t *parser) {
 	assert_d_eq(parser->token.token_type, TOKEN_TYPE_STRING,
 	    "Pair should start with string");
 	if (parser_tokenize(parser)) {
@@ -706,8 +698,7 @@
 }
 
 static bool
-parser_parse_values(parser_t *parser)
-{
+parser_parse_values(parser_t *parser) {
 	if (parser_parse_value(parser)) {
 		return true;
 	}
@@ -734,8 +725,7 @@
 }
 
 static bool
-parser_parse_array(parser_t *parser)
-{
+parser_parse_array(parser_t *parser) {
 	assert_d_eq(parser->token.token_type, TOKEN_TYPE_LBRACKET,
 	    "Array should start with [");
 	if (parser_tokenize(parser)) {
@@ -751,8 +741,7 @@
 }
 
 static bool
-parser_parse_pairs(parser_t *parser)
-{
+parser_parse_pairs(parser_t *parser) {
 	assert_d_eq(parser->token.token_type, TOKEN_TYPE_STRING,
 	    "Object should start with string");
 	if (parser_parse_pair(parser)) {
@@ -787,8 +776,7 @@
 }
 
 static bool
-parser_parse_object(parser_t *parser)
-{
+parser_parse_object(parser_t *parser) {
 	assert_d_eq(parser->token.token_type, TOKEN_TYPE_LBRACE,
 	    "Object should start with {");
 	if (parser_tokenize(parser)) {
@@ -806,8 +794,7 @@
 }
 
 static bool
-parser_parse(parser_t *parser)
-{
+parser_parse(parser_t *parser) {
 	if (parser_tokenize(parser)) {
 		goto label_error;
 	}
@@ -831,8 +818,7 @@
 	return true;
 }
 
-TEST_BEGIN(test_json_parser)
-{
+TEST_BEGIN(test_json_parser) {
 	size_t i;
 	const char *invalid_inputs[] = {
 		/* Tokenizer error case tests. */
@@ -929,16 +915,14 @@
 TEST_END
 
 void
-write_cb(void *opaque, const char *str)
-{
+write_cb(void *opaque, const char *str) {
 	parser_t *parser = (parser_t *)opaque;
 	if (parser_append(parser, str)) {
 		test_fail("Unexpected input appending failure");
 	}
 }
 
-TEST_BEGIN(test_stats_print_json)
-{
+TEST_BEGIN(test_stats_print_json) {
 	const char *opts[] = {
 		"J",
 		"Jg",
@@ -998,8 +982,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_json_parser,
 	    test_stats_print_json));
diff --git a/test/unit/ticker.c b/test/unit/ticker.c
index b8af46c..be54356 100644
--- a/test/unit/ticker.c
+++ b/test/unit/ticker.c
@@ -1,7 +1,6 @@
 #include "test/jemalloc_test.h"
 
-TEST_BEGIN(test_ticker_tick)
-{
+TEST_BEGIN(test_ticker_tick) {
 #define	NREPS 2
 #define	NTICKS 3
 	ticker_t ticker;
@@ -26,8 +25,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_ticker_ticks)
-{
+TEST_BEGIN(test_ticker_ticks) {
 #define	NTICKS 3
 	ticker_t ticker;
 
@@ -45,8 +43,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_ticker_copy)
-{
+TEST_BEGIN(test_ticker_copy) {
 #define	NTICKS 3
 	ticker_t ta, tb;
 
@@ -66,8 +63,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_ticker_tick,
 	    test_ticker_ticks,
diff --git a/test/unit/tsd.c b/test/unit/tsd.c
index 5313ef8..484dc30 100644
--- a/test/unit/tsd.c
+++ b/test/unit/tsd.c
@@ -10,8 +10,7 @@
 malloc_tsd_protos(, data_, data_t)
 
 void
-data_cleanup(void *arg)
-{
+data_cleanup(void *arg) {
 	data_t *data = (data_t *)arg;
 
 	if (!data_cleanup_executed) {
@@ -53,8 +52,7 @@
 malloc_tsd_funcs(, data_, data_t, DATA_INIT, data_cleanup)
 
 static void *
-thd_start(void *arg)
-{
+thd_start(void *arg) {
 	data_t d = (data_t)(uintptr_t)arg;
 	void *p;
 
@@ -76,14 +74,12 @@
 	return (NULL);
 }
 
-TEST_BEGIN(test_tsd_main_thread)
-{
+TEST_BEGIN(test_tsd_main_thread) {
 	thd_start((void *)(uintptr_t)0xa5f3e329);
 }
 TEST_END
 
-TEST_BEGIN(test_tsd_sub_thread)
-{
+TEST_BEGIN(test_tsd_sub_thread) {
 	thd_t thd;
 
 	data_cleanup_executed = false;
@@ -95,8 +91,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	/* Core tsd bootstrapping must happen prior to data_tsd_boot(). */
 	if (nallocx(1, 0) == 0) {
 		malloc_printf("Initialization error");
diff --git a/test/unit/util.c b/test/unit/util.c
index b891a19..3d1ecf4 100644
--- a/test/unit/util.c
+++ b/test/unit/util.c
@@ -31,26 +31,22 @@
 	}								\
 } while (0)
 
-TEST_BEGIN(test_pow2_ceil_u64)
-{
+TEST_BEGIN(test_pow2_ceil_u64) {
 	TEST_POW2_CEIL(uint64_t, u64, FMTu64);
 }
 TEST_END
 
-TEST_BEGIN(test_pow2_ceil_u32)
-{
+TEST_BEGIN(test_pow2_ceil_u32) {
 	TEST_POW2_CEIL(uint32_t, u32, FMTu32);
 }
 TEST_END
 
-TEST_BEGIN(test_pow2_ceil_zu)
-{
+TEST_BEGIN(test_pow2_ceil_zu) {
 	TEST_POW2_CEIL(size_t, zu, "zu");
 }
 TEST_END
 
-TEST_BEGIN(test_malloc_strtoumax_no_endptr)
-{
+TEST_BEGIN(test_malloc_strtoumax_no_endptr) {
 	int err;
 
 	set_errno(0);
@@ -60,8 +56,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_malloc_strtoumax)
-{
+TEST_BEGIN(test_malloc_strtoumax) {
 	struct test_s {
 		const char *input;
 		const char *expected_remainder;
@@ -155,8 +150,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_malloc_snprintf_truncated)
-{
+TEST_BEGIN(test_malloc_snprintf_truncated) {
 #define	BUFLEN	15
 	char buf[BUFLEN];
 	size_t result;
@@ -188,8 +182,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_malloc_snprintf)
-{
+TEST_BEGIN(test_malloc_snprintf) {
 #define	BUFLEN	128
 	char buf[BUFLEN];
 	size_t result;
@@ -302,8 +295,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_pow2_ceil_u64,
 	    test_pow2_ceil_u32,
diff --git a/test/unit/witness.c b/test/unit/witness.c
index 1359398..d75ca48 100644
--- a/test/unit/witness.c
+++ b/test/unit/witness.c
@@ -12,32 +12,27 @@
 
 static void
 witness_lock_error_intercept(const witness_list_t *witnesses,
-    const witness_t *witness)
-{
+    const witness_t *witness) {
 	saw_lock_error = true;
 }
 
 static void
-witness_owner_error_intercept(const witness_t *witness)
-{
+witness_owner_error_intercept(const witness_t *witness) {
 	saw_owner_error = true;
 }
 
 static void
-witness_not_owner_error_intercept(const witness_t *witness)
-{
+witness_not_owner_error_intercept(const witness_t *witness) {
 	saw_not_owner_error = true;
 }
 
 static void
-witness_lockless_error_intercept(const witness_list_t *witnesses)
-{
+witness_lockless_error_intercept(const witness_list_t *witnesses) {
 	saw_lockless_error = true;
 }
 
 static int
-witness_comp(const witness_t *a, void *oa, const witness_t *b, void *ob)
-{
+witness_comp(const witness_t *a, void *oa, const witness_t *b, void *ob) {
 	assert_u_eq(a->rank, b->rank, "Witnesses should have equal rank");
 
 	assert(oa == (void *)a);
@@ -47,8 +42,8 @@
 }
 
 static int
-witness_comp_reverse(const witness_t *a, void *oa, const witness_t *b, void *ob)
-{
+witness_comp_reverse(const witness_t *a, void *oa, const witness_t *b,
+    void *ob) {
 	assert_u_eq(a->rank, b->rank, "Witnesses should have equal rank");
 
 	assert(oa == (void *)a);
@@ -57,8 +52,7 @@
 	return (-strcmp(a->name, b->name));
 }
 
-TEST_BEGIN(test_witness)
-{
+TEST_BEGIN(test_witness) {
 	witness_t a, b;
 	tsdn_t *tsdn;
 
@@ -85,8 +79,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_witness_comp)
-{
+TEST_BEGIN(test_witness_comp) {
 	witness_t a, b, c, d;
 	tsdn_t *tsdn;
 
@@ -135,8 +128,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_witness_reversal)
-{
+TEST_BEGIN(test_witness_reversal) {
 	witness_t a, b;
 	tsdn_t *tsdn;
 
@@ -167,8 +159,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_witness_recursive)
-{
+TEST_BEGIN(test_witness_recursive) {
 	witness_t a;
 	tsdn_t *tsdn;
 
@@ -205,8 +196,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_witness_unlock_not_owned)
-{
+TEST_BEGIN(test_witness_unlock_not_owned) {
 	witness_t a;
 	tsdn_t *tsdn;
 
@@ -232,8 +222,7 @@
 }
 TEST_END
 
-TEST_BEGIN(test_witness_lockful)
-{
+TEST_BEGIN(test_witness_lockful) {
 	witness_t a;
 	tsdn_t *tsdn;
 
@@ -265,8 +254,7 @@
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_witness,
 	    test_witness_comp,
diff --git a/test/unit/zero.c b/test/unit/zero.c
index c752954..a802f05 100644
--- a/test/unit/zero.c
+++ b/test/unit/zero.c
@@ -6,8 +6,7 @@
 #endif
 
 static void
-test_zero(size_t sz_min, size_t sz_max)
-{
+test_zero(size_t sz_min, size_t sz_max) {
 	uint8_t *s;
 	size_t sz_prev, sz, i;
 #define	MAGIC	((uint8_t)0x61)
@@ -45,23 +44,20 @@
 #undef MAGIC
 }
 
-TEST_BEGIN(test_zero_small)
-{
+TEST_BEGIN(test_zero_small) {
 	test_skip_if(!config_fill);
 	test_zero(1, SMALL_MAXCLASS-1);
 }
 TEST_END
 
-TEST_BEGIN(test_zero_large)
-{
+TEST_BEGIN(test_zero_large) {
 	test_skip_if(!config_fill);
 	test_zero(SMALL_MAXCLASS+1, (1U << (LG_LARGE_MINCLASS+1)));
 }
 TEST_END
 
 int
-main(void)
-{
+main(void) {
 	return (test(
 	    test_zero_small,
 	    test_zero_large));