Update brace style.

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

This resolves #537.
This commit is contained in:
Jason Evans
2017-01-15 16:56:30 -08:00
parent 5154ff32ee
commit c4c2592c83
119 changed files with 2971 additions and 3572 deletions

View File

@@ -6,8 +6,7 @@ const char *malloc_conf =
#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 @@ prof_dump_open_intercept(bool propagate_err, const char *filename)
}
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 @@ get_lg_prof_sample(void)
}
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 @@ do_prof_reset(size_t lg_prof_sample)
"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 @@ bool prof_dump_header_intercepted = false;
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 @@ TEST_END
#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 @@ thd_start(void *varg)
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 @@ TEST_BEGIN(test_prof_reset)
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_END
/* 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 @@ TEST_END
#undef NITER
int
main(void)
{
main(void) {
/* Intercept dumping prior to running any tests. */
prof_dump_open = prof_dump_open_intercept;