summaryrefslogtreecommitdiffstats
path: root/test/stress
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-01-16 00:56:30 (GMT)
committerJason Evans <jasone@canonware.com>2017-01-21 05:43:07 (GMT)
commitc4c2592c834d8a37beb0a0d53842095160cbf9ee (patch)
treee4717ea6a2f13926dadd74ea1fc83f9742f77968 /test/stress
parent5154ff32ee8c37bacb6afd8a07b923eb33228357 (diff)
downloadjemalloc-c4c2592c834d8a37beb0a0d53842095160cbf9ee.zip
jemalloc-c4c2592c834d8a37beb0a0d53842095160cbf9ee.tar.gz
jemalloc-c4c2592c834d8a37beb0a0d53842095160cbf9ee.tar.bz2
Update brace style.
Add braces around single-line blocks, and remove line breaks before function-opening braces. This resolves #537.
Diffstat (limited to 'test/stress')
-rw-r--r--test/stress/microbench.c57
1 files changed, 23 insertions, 34 deletions
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 @@ compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
}
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 @@ malloc_free(void)
}
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 @@ mallocx_free(void)
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 @@ malloc_dallocx(void)
}
static void
-malloc_sdallocx(void)
-{
+malloc_sdallocx(void) {
void *p = malloc(1);
if (p == NULL) {
test_fail("Unexpected malloc() failure");
@@ -92,23 +87,20 @@ malloc_sdallocx(void)
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 @@ malloc_mus_free(void)
}
static void
-malloc_sallocx_free(void)
-{
+malloc_sallocx_free(void) {
void *p;
p = malloc(1);
@@ -130,21 +121,20 @@ malloc_sallocx_free(void)
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 @@ malloc_nallocx_free(void)
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,