summaryrefslogtreecommitdiff
path: root/tests/gctest.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-04-30 19:00:14 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-05-01 00:22:50 +0300
commitd833880a0f3cab314cd1f06a1a1bec5024cfdacd (patch)
tree2946a5fa0779341719b677e08d97c53626646610 /tests/gctest.c
parentdad61d707e943043174e171cc1b2b6a1497a0d36 (diff)
downloadbdwgc-d833880a0f3cab314cd1f06a1a1bec5024cfdacd.tar.gz
Remove extra parentheses in return statement
(refactoring) Also, replace 0 to NULL where appropriate. * allchblk.c (setup_header, GC_get_first_part, GC_allochblk_nth): Remove outermost parentheses in the expression of return statement. * alloc.c (GC_never_stop_func, GC_timeout_stop_func, GC_adj_bytes_allocd, GC_try_to_collect_inner, GC_collect_a_little, GC_stopped_mark, GC_try_to_collect_general, GC_expand_hp_inner, GC_collect_or_expand, GC_allocobj): Likewise. * blacklst.c (GC_is_black_listed, GC_number_stack_black_listed, total_stack_black_listed): Likewise. * checksums.c (GC_checksum): Likewise. * cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_len, CORD_index_access_fn, CORD_apply_access_fn, CORD_substr_checked, CORD_substr, CORD_iter5, CORD_iter, CORD_riter4, CORD_riter, CORD_concat_forest, CORD_balance, CORD__pos_fetch, CORD__prev, CORD_prev, CORD_pos_to_cord, CORD_pos_valid): Likewise. * cord/cordprnt.c (extract_conv_spec, CORD_vsprintf, CORD_sprintf, CORD_fprintf, CORD_vfprintf, CORD_printf, CORD_vprintf): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_catn, CORD_fill_proc, CORD_batched_fill_proc, CORD_cmp, CORD_ncmp, CORD_to_char_star, CORD_from_char_star, CORD_to_const_char_star, CORD_fetch, CORD_put_proc, CORD_batched_put_proc, CORD_put, CORD_chr_proc, CORD_rchr_proc, CORD_batched_chr_proc, CORD_chr, CORD_rchr, CORD_str, CORD_from_file_eager, CORD_lf_func, CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file): Likewise. * cord/tests/cordtest.c (test_fn, id_cord_fn, test_basics): Likewise. * cord/tests/de.c (line_pos, add_hist, retrieve_line, beep): Likewise. * cord/tests/de_win.c (WinMain, plain_chars, control_chars, WndProc): Likewise. * dbg_mlc.c (store_debug_info, GC_debug_generic_malloc, GC_debug_generic_malloc, GC_debug_realloc, GC_make_closure): Likewise. * dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise. * extra/real_malloc.c (real_malloc): Likewise. * finalize.c (GC_register_disappearing_link, GC_unregister_disappearing_link): Likewise. * gc_dlopen.c (dlopen): Likewise. * gcj_mlc.c (maybe_finalize, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * headers.c (GC_find_header, alloc_hdr, get_index, GC_install_header, GC_next_block, GC_prev_block): Likewise. * malloc.c (GC_generic_malloc): Likewise. * mallocx.c (GC_realloc, GC_generic_malloc_ignore_off_page): Likewise. * mark.c (GC_collection_in_progress, GC_mark_some, GC_signal_mark_stack_overflow, GC_block_was_dirty, GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Likewise. * mark_rts.c (GC_is_static_root, rt_hash, GC_roots_present, GC_remove_tmp_roots, GC_approx_sp): Likewise. * misc.c (GC_default_oom_fn, GC_clear_stack_inner, GC_base, GC_write, GC_get_warn_proc, GC_call_with_alloc_lock): Likewise. * new_hblk.c (GC_build_fl_clear2, GC_build_fl_clear4, GC_build_fl2, GC_build_fl4, GC_build_fl): Likewise. * obj_map.c (GC_register_displacement_inner): Likewise. * os_dep.c (GC_find_limit_openbsd, GC_skip_hole_openbsd, GC_get_writable_length, GC_get_writable_length, GC_get_main_stack_base, GC_FreeBSDGetDataStart, GC_unix_mmap_get_mem, GC_unix_sbrk_get_mem, os2_alloc, GC_wince_get_mem, GC_win32_get_mem, GC_push_thread_stack, GC_push_old_obj, GC_write_fault_handler, catch_exception_raise_state, catch_exception_raise_state_identity): Likewise. * pthread_support.c (GC_new_thread, GC_lookup_thread, GC_get_nprocs, pthread_sigmask, pthread_create): Likewise. * ptr_chck.c (GC_same_obj, GC_default_is_visible_print_proc, GC_default_is_valid_displacement_print_proc, GC_is_visible, GC_pre_incr, GC_post_incr): Likewise. * reclaim.c (GC_block_empty, GC_reclaim_uninit, GC_n_set_marks, GC_reclaim_all): Likewise. * tests/cpp.cc (main): Likewise. * tests/gctest.c (fake_gcj_mark_proc, reverse1, reverse, ints, gcj_reverse1, gcj_reverse, gcj_ints, uncollectable_ints, mktree, alloc8bytes, main, test): Likewise. * tools/if_mach.c (main): Likewise. * tools/if_not_there.c (main): Likewise. * tools/setjmp_t.c (getpagesize, main, g): Likewise. * typd_mlc.c (GC_add_ext_descriptor, GC_add_ext_descriptor, GC_double_descr, GC_make_array_descriptor, GC_make_sequence_descriptor, GC_typed_mark_proc, GC_descr_obj_size, GC_push_complex_descriptor, GC_array_mark_proc, GC_make_descriptor, GC_calloc_explicitly_typed): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner, GC_get_stack_min, GC_pthread_create, GC_pthread_start_inner): Likewise. * allchblk.c (GC_get_first_part, GC_allochblk_nth): Replace 0 to NULL where appropriate. * alloc.c (GC_allocobj): Likewise. * blacklst.c (GC_is_black_listed): Likewise. * cord/cordbscs.c (CORD_from_fn_inner, CORD_substr_checked): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_to_char_star, CORD_from_char_star, CORD_lf_func, CORD_from_file_lazy_inner): Likewise. * dbg_mlc.c (store_debug_info, GC_debug_generic_malloc, GC_debug_generic_malloc): Likewise. * dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise. * gcj_mlc.c (GC_debug_gcj_malloc): Likewise. * headers.c (GC_next_block, GC_prev_block): Likewise. * malloc.c (GC_generic_malloc, strdup): Likewise. * mallocx.c (GC_realloc): Likewise. * misc.c (GC_default_oom_fn, GC_base): Likewise. * os_dep.c (GC_get_main_stack_base, os2_alloc, GC_win32_get_mem): Likewise. * pthread_support.c (GC_new_thread, GC_lookup_thread): Likewise. * ptr_chck.c (GC_same_obj, GC_is_visible, GC_default_is_valid_displacement_print_proc): Likewise. * tests/gctest.c (mktree): Likewise. * typd_mlc.c (GC_make_array_descriptor, GC_push_complex_descriptor, GC_array_mark_proc, GC_calloc_explicitly_typed): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner): Likewise. * alloc.c (GC_never_stop_func, GC_timeout_stop_func): Replace 0 and 1 (in return statement) to FALSE and TRUE, respectively. * include/private/gcconfig.h: Remove outermost parentheses in the expression of return statement in comment.
Diffstat (limited to 'tests/gctest.c')
-rw-r--r--tests/gctest.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/gctest.c b/tests/gctest.c
index b394ce2a..a6a91c68 100644
--- a/tests/gctest.c
+++ b/tests/gctest.c
@@ -380,7 +380,7 @@ struct GC_ms_entry * fake_gcj_mark_proc(word * addr,
mark_stack_ptr = GC_MARK_AND_PUSH(
(void *)(x -> sexpr_car), mark_stack_ptr,
mark_stack_limit, (void * *)&(x -> sexpr_car));
- return(mark_stack_ptr);
+ return mark_stack_ptr;
}
#endif /* GC_GCJ_SUPPORT */
@@ -447,9 +447,9 @@ sexpr small_cons_uncollectable (sexpr x, sexpr y)
sexpr reverse1(sexpr x, sexpr y)
{
if (is_nil(x)) {
- return(y);
+ return y;
} else {
- return( reverse1(cdr(x), cons(car(x), y)) );
+ return reverse1(cdr(x), cons(car(x), y));
}
}
@@ -458,13 +458,13 @@ sexpr reverse(sexpr x)
# ifdef TEST_WITH_SYSTEM_MALLOC
GC_noop1(GC_HIDE_POINTER(malloc(100000)));
# endif
- return( reverse1(x, nil) );
+ return reverse1(x, nil);
}
sexpr ints(int low, int up)
{
if (low > up) {
- return(nil);
+ return nil;
} else {
return small_cons(small_cons_leaf(low), ints(low + 1, up));
}
@@ -475,23 +475,23 @@ sexpr ints(int low, int up)
sexpr gcj_reverse1(sexpr x, sexpr y)
{
if (is_nil(x)) {
- return(y);
+ return y;
} else {
- return( gcj_reverse1(cdr(x), gcj_cons(car(x), y)) );
+ return gcj_reverse1(cdr(x), gcj_cons(car(x), y));
}
}
sexpr gcj_reverse(sexpr x)
{
- return( gcj_reverse1(x, nil) );
+ return gcj_reverse1(x, nil);
}
sexpr gcj_ints(int low, int up)
{
if (low > up) {
- return(nil);
+ return nil;
} else {
- return(gcj_cons(gcj_cons(INT_TO_SEXPR(low), nil), gcj_ints(low+1, up)));
+ return gcj_cons(gcj_cons(INT_TO_SEXPR(low), nil), gcj_ints(low+1, up));
}
}
#endif /* GC_GCJ_SUPPORT */
@@ -501,10 +501,10 @@ sexpr gcj_ints(int low, int up)
sexpr uncollectable_ints(int low, int up)
{
if (low > up) {
- return(nil);
+ return nil;
} else {
- return(small_cons_uncollectable(small_cons_leaf(low),
- uncollectable_ints(low+1, up)));
+ return small_cons_uncollectable(small_cons_leaf(low),
+ uncollectable_ints(low+1, up));
}
}
@@ -956,7 +956,7 @@ tn * mktree(int n)
CHECK_OUT_OF_MEMORY(live_indicators);
}
# endif
- if (n == 0) return(0);
+ if (0 == n) return NULL;
CHECK_OUT_OF_MEMORY(result);
result -> level = n;
result -> lchild = left = mktree(n - 1);
@@ -1069,7 +1069,7 @@ tn * mktree(int n)
GC_END_STUBBORN_CHANGE(result);
GC_reachable_here(left);
GC_reachable_here(right);
- return(result);
+ return result;
}
void chktree(tn *t, int n)
@@ -1104,7 +1104,7 @@ void * alloc8bytes(void)
{
# if defined(SMALL_CONFIG) || defined(GC_DEBUG)
AO_fetch_and_add1(&collectable_count);
- return(GC_MALLOC(8));
+ return GC_MALLOC(8);
# else
void ** my_free_list_ptr;
void * my_free_list;
@@ -1129,7 +1129,7 @@ void * alloc8bytes(void)
GC_PTR_STORE_AND_DIRTY(my_free_list_ptr, next);
GC_NEXT(my_free_list) = 0;
AO_fetch_and_add1(&collectable_count);
- return(my_free_list);
+ return my_free_list;
# endif
}
@@ -2153,7 +2153,7 @@ void enable_incremental_mode(void)
# ifdef RTEMS
exit(0);
# else
- return(0);
+ return 0;
# endif
}
# endif /* !GC_WIN32_THREADS && !GC_PTHREADS */
@@ -2321,7 +2321,7 @@ DWORD __stdcall thr_window(void * arg GC_ATTR_UNUSED)
UNTESTED(GC_endthreadex);
# endif
# endif
- return(0);
+ return 0;
}
#endif /* GC_WIN32_THREADS */
@@ -2356,7 +2356,7 @@ int test(void)
}
run_single_threaded_test();
check_heap_stats();
- return(0);
+ return 0;
}
#endif
@@ -2366,7 +2366,7 @@ int test(void)
void * thr_run_one_test(void * arg GC_ATTR_UNUSED)
{
run_one_test();
- return(0);
+ return 0;
}
#ifdef GC_DEBUG
@@ -2529,6 +2529,6 @@ int main(void)
pthread_win32_thread_detach_np ();
pthread_win32_process_detach_np ();
# endif
- return(0);
+ return 0;
}
#endif /* GC_PTHREADS */