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

@@ -5,8 +5,7 @@ const char *malloc_conf = "junk:false";
#endif
static unsigned
get_nsizes_impl(const char *cmd)
{
get_nsizes_impl(const char *cmd) {
unsigned ret;
size_t z;
@@ -18,14 +17,12 @@ get_nsizes_impl(const char *cmd)
}
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 @@ get_size_impl(const char *cmd, size_t 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));
}
@@ -54,14 +50,12 @@ get_large_size(size_t ind)
* 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_BEGIN(test_overflow)
}
TEST_END
TEST_BEGIN(test_oom)
{
TEST_BEGIN(test_oom) {
size_t largemax;
bool oom;
void *ptrs[3];
@@ -96,15 +89,17 @@ TEST_BEGIN(test_oom)
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_BEGIN(test_oom)
}
TEST_END
TEST_BEGIN(test_basic)
{
TEST_BEGIN(test_basic) {
#define MAXSZ (((size_t)1) << 23)
size_t sz;
@@ -160,16 +154,16 @@ TEST_BEGIN(test_basic)
}
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 @@ TEST_BEGIN(test_alignment_and_size)
" 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_BEGIN(test_alignment_and_size)
TEST_END
int
main(void)
{
main(void) {
return (test(
test_overflow,
test_oom,