aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/support/stack_lockfree_test.c
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-07-14 14:52:34 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-07-14 14:52:34 -0700
commitd54c3e6b39643c34e7466ff826a4a9f2b909a769 (patch)
treec70f7a2f1ecc8c88ec746633bac9f53c5c13cd38 /test/core/support/stack_lockfree_test.c
parentd6cc1814c069f9023b886af7119d0b4ea9f49688 (diff)
clang-format changed files
Diffstat (limited to 'test/core/support/stack_lockfree_test.c')
-rw-r--r--test/core/support/stack_lockfree_test.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.c
index ebee04d5b8..42082de389 100644
--- a/test/core/support/stack_lockfree_test.c
+++ b/test/core/support/stack_lockfree_test.c
@@ -59,13 +59,13 @@ static void test_serial_sized(int size) {
GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1);
/* Now add repeatedly more items and check them */
- for (i=1; i<size; i*=2) {
+ for (i = 1; i < size; i *= 2) {
int j;
- for (j=0; j<=i; j++) {
+ for (j = 0; j <= i; j++) {
gpr_stack_lockfree_push(stack, j);
}
- for (j=0; j<=i; j++) {
- GPR_ASSERT(gpr_stack_lockfree_pop(stack) == i-j);
+ for (j = 0; j <= i; j++) {
+ GPR_ASSERT(gpr_stack_lockfree_pop(stack) == i - j);
}
GPR_ASSERT(gpr_stack_lockfree_pop(stack) == -1);
}
@@ -75,7 +75,7 @@ static void test_serial_sized(int size) {
static void test_serial() {
int i;
- for (i=128; i<MAX_STACK_SIZE; i*=2) {
+ for (i = 128; i < MAX_STACK_SIZE; i *= 2) {
test_serial_sized(i);
}
test_serial_sized(MAX_STACK_SIZE);
@@ -94,9 +94,9 @@ static void test_mt_body(void *v) {
int lo, hi;
int i;
int res;
- lo = arg->rank*arg->stack_size/arg->nthreads;
- hi = (arg->rank+1)*arg->stack_size/arg->nthreads;
- for (i=lo; i<hi; i++) {
+ lo = arg->rank * arg->stack_size / arg->nthreads;
+ hi = (arg->rank + 1) * arg->stack_size / arg->nthreads;
+ for (i = lo; i < hi; i++) {
gpr_stack_lockfree_push(arg->stack, i);
if ((res = gpr_stack_lockfree_pop(arg->stack)) != -1) {
arg->sum += res;
@@ -116,7 +116,7 @@ static void test_mt_sized(int size, int nth) {
gpr_thd_options options = gpr_thd_options_default();
stack = gpr_stack_lockfree_create(size);
- for (i=0; i<nth; i++) {
+ for (i = 0; i < nth; i++) {
args[i].stack = stack;
args[i].stack_size = size;
args[i].nthreads = nth;
@@ -132,17 +132,17 @@ static void test_mt_sized(int size, int nth) {
gpr_thd_join(thds[i]);
sum = sum + args[i].sum;
}
- GPR_ASSERT((unsigned)sum == ((unsigned)size*(size-1))/2);
+ GPR_ASSERT((unsigned)sum == ((unsigned)size * (size - 1)) / 2);
gpr_stack_lockfree_destroy(stack);
}
static void test_mt() {
int size, nth;
- for (nth=1; nth < MAX_THREADS; nth++) {
- for (size=128; size < MAX_STACK_SIZE; size*=2) {
- test_mt_sized(size,nth);
+ for (nth = 1; nth < MAX_THREADS; nth++) {
+ for (size = 128; size < MAX_STACK_SIZE; size *= 2) {
+ test_mt_sized(size, nth);
}
- test_mt_sized(MAX_STACK_SIZE,nth);
+ test_mt_sized(MAX_STACK_SIZE, nth);
}
}