From 160fc95e66e82d844ef0f5a258c03de844524a6e Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 14 Jun 2020 16:08:32 +0200 Subject: [PATCH] Use (void) instead of () in function signatures (#17026) ##refactoring * Use (void) instead of () in function signatures * Add test to avoid further contributions to commit the same mistake --- DEVELOPERS.md | 12 ++-- binr/preload/libr2.c | 10 +-- binr/r2r/run.c | 2 +- libr/anal/cond.c | 2 +- libr/anal/cycles.c | 4 +- libr/anal/diff.c | 4 +- libr/anal/esil_cfg.c | 2 +- libr/anal/fcn.c | 2 +- libr/anal/op.c | 6 +- libr/anal/p/anal_java.c | 4 +- libr/anal/sign.c | 4 +- libr/anal/switch.c | 2 +- libr/anal/value.c | 4 +- libr/anal/xrefs.c | 2 +- libr/asm/aop.c | 4 +- libr/asm/arch/xtensa/gnu/xtensa-dis.c | 2 +- libr/asm/asm.c | 4 +- libr/asm/p/asm_x86_cs.c | 2 +- libr/bin/bin.c | 2 +- libr/bin/format/objc/mach0_classes.c | 2 +- libr/bin/format/xnu/r_cf_dict.c | 12 ++-- libr/bin/p/bin_nso.c | 2 +- libr/bin/p/bin_xnu_kernelcache.c | 2 +- libr/bin/pdb/fpo.c | 4 +- libr/bin/pdb/main.c | 2 +- libr/bin/pdb/pdb_downloader.c | 13 ++-- libr/bp/bp.c | 4 +- libr/bp/bp_traptrace.c | 2 +- libr/bp/bp_watch.c | 2 +- libr/cons/2048.c | 8 +-- libr/cons/cons.c | 62 +++++++++--------- libr/cons/cutf8.c | 8 +-- libr/cons/dietline.c | 68 +++++++++---------- libr/cons/editor.c | 2 +- libr/cons/grep.c | 3 +- libr/cons/input.c | 6 +- libr/cons/more.c | 2 +- libr/cons/pal.c | 14 ++-- libr/cons/rgb.c | 4 +- libr/core/casm.c | 4 +- libr/core/cmd_anal.c | 2 +- libr/core/cmd_api.c | 6 +- libr/core/cmd_eval.c | 2 +- libr/core/core.c | 2 +- libr/core/corelog.c | 4 +- libr/core/p/core_test.c | 2 +- libr/core/panels.c | 8 +-- libr/core/visual.c | 2 +- libr/core/windows_heap.c | 6 +- libr/crypto/crypto.c | 4 +- libr/debug/dmap.c | 2 +- libr/debug/p/debug_native.c | 2 +- libr/debug/p/native/w32.c | 10 +-- libr/debug/p/native/windows/windows_debug.c | 4 +- libr/debug/p/native/xnu/xnu_debug.c | 2 +- libr/debug/snap.c | 4 +- libr/debug/trace.c | 4 +- libr/egg/egg.c | 2 +- libr/egg/egg_lang.c | 3 +- libr/flag/flag.c | 2 +- libr/fs/fs.c | 4 +- libr/include/r_types.h | 2 +- libr/io/io.c | 2 +- libr/io/p/io_debug.c | 2 +- libr/io/p/io_winedbg.c | 2 +- libr/lang/lang.c | 2 +- libr/main/r2agent.c | 2 +- libr/main/rahash2.c | 2 +- libr/main/rarun2.c | 2 +- libr/main/rasign2.c | 2 +- libr/main/rasm2.c | 2 +- libr/main/rax2.c | 6 +- libr/parse/ctype.c | 4 +- libr/reg/profile.c | 2 +- libr/search/bytepat.c | 2 +- libr/search/old_xrefs.c | 4 +- libr/socket/r2pipe.c | 2 +- libr/socket/run.c | 2 +- libr/syscall/syscall.c | 4 +- libr/util/alloc.c | 4 +- libr/util/ascii_table.c | 2 +- libr/util/cache.c | 4 +- libr/util/file.c | 2 +- libr/util/graph.c | 4 +- libr/util/list.c | 7 +- libr/util/pj.c | 2 +- libr/util/print.c | 2 +- libr/util/range.c | 4 +- libr/util/rbtree.c | 2 +- libr/util/regex/test.c | 4 +- libr/util/sandbox.c | 8 ++- libr/util/sys.c | 6 +- libr/util/table.c | 2 +- libr/util/thread_cond.c | 4 +- libr/util/udiff.c | 4 +- libr/util/unum.c | 2 +- libr/util/w32-sys.c | 2 +- shlr/java/class.c | 18 +++--- shlr/java/code.c | 14 ++-- shlr/tcc/tcc.h | 2 +- test/db/tools/r2 | 11 ++++ test/unit/legacy_unit/egg/test.c | 2 +- test/unit/test_anal_types.c | 10 +-- test/unit/test_annotated_code.c | 28 ++++---- test/unit/test_vector.c | 72 ++++++++++----------- 105 files changed, 325 insertions(+), 320 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index d967fd2ce9..934e4e8842 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -165,12 +165,12 @@ a = (b << 3) * 5; The structure of the C files in r2 must be like this: ```c -/* Copyright ... */ ## copyright -#include ## includes -static int globals ## const, define, global variables -static void helper() {} ## static functions -R_IPI void internal() {} ## internal apis (used only inside the library) -R_API void public() {} ## public apis starting with constructor/destructor +/* Copyright ... */ ## copyright +#include ## includes +static int globals ## const, define, global variables +static void helper(void) {} ## static functions +R_IPI void internal(void) {} ## internal apis (used only inside the library) +R_API void public(void) {} ## public apis starting with constructor/destructor ``` diff --git a/binr/preload/libr2.c b/binr/preload/libr2.c index dc69d0439b..991d049e82 100644 --- a/binr/preload/libr2.c +++ b/binr/preload/libr2.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2014-2016 - pancake */ +/* radare - LGPL - Copyright 2014-2020 - pancake */ #include @@ -30,12 +30,12 @@ static void sigusr1(int s) { } static void sigusr2(int s) { - (void)openself(); + (void)openself (); r_core_cmd0 (core, "=H&"); } static void _libwrap_init() __attribute__ ((constructor)); -static void _libwrap_init() { +static void _libwrap_init(void) { char *web; r_sys_signal (SIGUSR1, sigusr1); r_sys_signal (SIGUSR2, sigusr2); @@ -54,7 +54,7 @@ static void _libwrap_init() { // TODO: open io_self } #elif __WINDOWS__ -void alloc_console() { +void alloc_console(void) { CONSOLE_SCREEN_BUFFER_INFO coninfo; HANDLE hStdin = GetStdHandle (STD_INPUT_HANDLE); DWORD lpMode; @@ -71,7 +71,7 @@ void alloc_console() { freopen ("conout$", "w", stderr); } -static void start_r2() { +static void start_r2(void) { core = r_core_new (); r_core_loadlibs (core, R_CORE_LOADLIBS_ALL, NULL); RCoreFile *fd = r_core_file_open (core, "self://", R_PERM_RW, 0); diff --git a/binr/r2r/run.c b/binr/r2r/run.c index 305d28f618..8635809a12 100644 --- a/binr/r2r/run.c +++ b/binr/r2r/run.c @@ -236,7 +236,7 @@ error: goto beach; } -static ut64 now_us() { +static ut64 now_us(void) { LARGE_INTEGER f; if (!QueryPerformanceFrequency (&f)) { return 0; diff --git a/libr/anal/cond.c b/libr/anal/cond.c index 06c9fd4083..0e935640ce 100644 --- a/libr/anal/cond.c +++ b/libr/anal/cond.c @@ -24,7 +24,7 @@ R_API const char *r_anal_cond_tostring(int cc) { return "??"; } -R_API RAnalCond *r_anal_cond_new() { +R_API RAnalCond *r_anal_cond_new(void) { return R_NEW0 (RAnalCond); } diff --git a/libr/anal/cycles.c b/libr/anal/cycles.c index a2836405a8..76f4a948a6 100644 --- a/libr/anal/cycles.c +++ b/libr/anal/cycles.c @@ -1,10 +1,10 @@ -/* radare - LGPL - Copyright 2014 - 2015 - condret */ +/* radare - LGPL - Copyright 2014-2020 - condret */ #include #include #include -R_API RAnalCycleFrame *r_anal_cycle_frame_new() { +R_API RAnalCycleFrame *r_anal_cycle_frame_new(void) { RAnalCycleFrame *cf = R_NEW0 (RAnalCycleFrame); if (cf) { if (!(cf->hooks = r_list_new ())) { diff --git a/libr/anal/diff.c b/libr/anal/diff.c index 4460f209af..e6a8226784 100644 --- a/libr/anal/diff.c +++ b/libr/anal/diff.c @@ -1,10 +1,10 @@ -/* radare - LGPL - Copyright 2010-2017 - nibble, pancake */ +/* radare - LGPL - Copyright 2010-2020 - nibble, pancake */ #include #include #include -R_API RAnalDiff *r_anal_diff_new() { +R_API RAnalDiff *r_anal_diff_new(void) { RAnalDiff *diff = R_NEW0 (RAnalDiff); if (diff) { diff->type = R_ANAL_DIFF_TYPE_NULL; diff --git a/libr/anal/esil_cfg.c b/libr/anal/esil_cfg.c index 77b6e1928a..ae17dd6912 100644 --- a/libr/anal/esil_cfg.c +++ b/libr/anal/esil_cfg.c @@ -498,7 +498,7 @@ static RAnalEsilCFG *esil_cfg_gen(RAnalEsilCFG *cfg, RAnal *anal, RIDStorage *at return cfg; } -R_API RAnalEsilCFG *r_anal_esil_cfg_new() { +R_API RAnalEsilCFG *r_anal_esil_cfg_new(void) { RAnalEsilCFG *cf = R_NEW0 (RAnalEsilCFG); if (cf) { RAnalEsilBB *p = R_NEW0 (RAnalEsilBB); diff --git a/libr/anal/fcn.c b/libr/anal/fcn.c index f4bd950aa5..a7784ad9c8 100644 --- a/libr/anal/fcn.c +++ b/libr/anal/fcn.c @@ -86,7 +86,7 @@ static int read_ahead(RAnal *anal, ut64 addr, ut8 *buf, int len) { } #endif -R_API void r_anal_fcn_invalidate_read_ahead_cache() { +R_API void r_anal_fcn_invalidate_read_ahead_cache(void) { #if READ_AHEAD cache_addr = UT64_MAX; #endif diff --git a/libr/anal/op.c b/libr/anal/op.c index c998131446..a6a027a688 100644 --- a/libr/anal/op.c +++ b/libr/anal/op.c @@ -1,16 +1,16 @@ -/* radare - LGPL - Copyright 2010-2019 - pancake, nibble */ +/* radare - LGPL - Copyright 2010-2020 - pancake, nibble */ #include #include #include -R_API RAnalOp *r_anal_op_new() { +R_API RAnalOp *r_anal_op_new(void) { RAnalOp *op = R_NEW (RAnalOp); r_anal_op_init (op); return op; } -R_API RList *r_anal_op_list_new() { +R_API RList *r_anal_op_list_new(void) { RList *list = r_list_new (); if (list) { list->free = &r_anal_op_free; diff --git a/libr/anal/p/anal_java.c b/libr/anal/p/anal_java.c index 1341af6187..c009e9928e 100644 --- a/libr/anal/p/anal_java.c +++ b/libr/anal/p/anal_java.c @@ -36,14 +36,14 @@ static RBinJavaObj * get_java_bin_obj(RAnal *anal) { return is_java ? b->cur->o->bin_obj : NULL; } -static ut64 java_get_method_start () { +static ut64 java_get_method_start(void) { return METHOD_START; } static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) { ut8 op_byte = data[0]; ut64 offset = addr - java_get_method_start (); - ut8 pos = (offset+1)%4 ? 1 + 4 - (offset+1)%4 : 1; + ut8 pos = (offset + 1)%4 ? 1 + 4 - (offset+1)%4 : 1; if (op_byte == 0xaa) { // handle a table switch condition diff --git a/libr/anal/sign.c b/libr/anal/sign.c index 3a135b5794..ad230d9635 100644 --- a/libr/anal/sign.c +++ b/libr/anal/sign.c @@ -1989,7 +1989,7 @@ R_API bool r_sign_foreach(RAnal *a, RSignForeachCallback cb, void *user) { return sdb_foreach (a->sdb_zigns, foreachCB, &ctx); } -R_API RSignSearch *r_sign_search_new() { +R_API RSignSearch *r_sign_search_new(void) { RSignSearch *ret = R_NEW0 (RSignSearch); if (ret) { ret->search = r_search_new (R_SEARCH_KEYWORD); @@ -2325,7 +2325,7 @@ R_API bool r_sign_match_types(RAnal *a, RAnalFunction *fcn, RSignVarsMatchCallba return r_sign_foreach (a, typesMatchCB, &ctx); } -R_API RSignItem *r_sign_item_new() { +R_API RSignItem *r_sign_item_new(void) { RSignItem *ret = R_NEW0 (RSignItem); if (ret) { ret->addr = UT64_MAX; diff --git a/libr/anal/switch.c b/libr/anal/switch.c index 3558e51cf2..2d98ace9df 100644 --- a/libr/anal/switch.c +++ b/libr/anal/switch.c @@ -2,7 +2,7 @@ #include -static RAnalSwitchOp *__switch_op_new() { +static RAnalSwitchOp *__switch_op_new(void) { RAnalSwitchOp * swop = R_NEW0 (RAnalSwitchOp); if (swop) { swop->cases = r_list_new (); diff --git a/libr/anal/value.c b/libr/anal/value.c index 34dffc4228..a994d536cb 100644 --- a/libr/anal/value.c +++ b/libr/anal/value.c @@ -1,8 +1,8 @@ -/* radare - LGPL - Copyright 2010-2011 - pancake */ +/* radare - LGPL - Copyright 2010-2020 - pancake */ #include -R_API RAnalValue *r_anal_value_new() { //macro for this ? +R_API RAnalValue *r_anal_value_new(void) { //macro for this ? return R_NEW0 (RAnalValue); } diff --git a/libr/anal/xrefs.c b/libr/anal/xrefs.c index 57357b87fe..1b5e64f637 100644 --- a/libr/anal/xrefs.c +++ b/libr/anal/xrefs.c @@ -38,7 +38,7 @@ static void r_anal_ref_free(void *ref) { free (ref); } -R_API RList *r_anal_ref_list_new() { +R_API RList *r_anal_ref_list_new(void) { return r_list_newf (r_anal_ref_free); } diff --git a/libr/asm/aop.c b/libr/asm/aop.c index 5fe32cd818..0296d32667 100644 --- a/libr/asm/aop.c +++ b/libr/asm/aop.c @@ -1,8 +1,8 @@ -/* radare - LGPL - Copyright 2018-2019 - pancake */ +/* radare - LGPL - Copyright 2018-2020 - pancake */ #include -R_API RAsmOp *r_asm_op_new() { +R_API RAsmOp *r_asm_op_new(void) { return R_NEW0 (RAsmOp); } diff --git a/libr/asm/arch/xtensa/gnu/xtensa-dis.c b/libr/asm/arch/xtensa/gnu/xtensa-dis.c index 9c9fce934c..12e54cbb91 100644 --- a/libr/asm/arch/xtensa/gnu/xtensa-dis.c +++ b/libr/asm/arch/xtensa/gnu/xtensa-dis.c @@ -41,7 +41,7 @@ extern xtensa_isa xtensa_default_isa; #endif #if 1 -static void nothing() { +static void nothing(void) { return; } diff --git a/libr/asm/asm.c b/libr/asm/asm.c index e61f9bc459..b35636a892 100644 --- a/libr/asm/asm.c +++ b/libr/asm/asm.c @@ -191,7 +191,7 @@ static void plugin_free(RAsmPlugin *p) { } } -R_API RAsm *r_asm_new() { +R_API RAsm *r_asm_new(void) { int i; RAsm *a = R_NEW0 (RAsm); if (!a) { @@ -556,7 +556,7 @@ static char *replace_directives(char *str) { return o; } -R_API void r_asm_list_directives() { +R_API void r_asm_list_directives(void) { int i = 0; char *dir = directives[i++]; while (dir) { diff --git a/libr/asm/p/asm_x86_cs.c b/libr/asm/p/asm_x86_cs.c index 301448bd4f..b8187ac1aa 100644 --- a/libr/asm/p/asm_x86_cs.c +++ b/libr/asm/p/asm_x86_cs.c @@ -199,7 +199,7 @@ static int check_features(RAsm *a, cs_insn *insn) { } #ifndef R2_PLUGIN_INCORE -R_API RLibStruct *radare_plugin_function() { +R_API RLibStruct *radare_plugin_function(void) { RLibStruct *rp = R_NEW0 (RLibStruct); if (rp) { rp->type = R_LIB_TYPE_ASM; diff --git a/libr/bin/bin.c b/libr/bin/bin.c index ea80aa8a7b..6fdfa8f229 100644 --- a/libr/bin/bin.c +++ b/libr/bin/bin.c @@ -832,7 +832,7 @@ R_API int r_bin_is_static(RBin *bin) { return true; } -R_API RBin *r_bin_new() { +R_API RBin *r_bin_new(void) { int i; RBinXtrPlugin *static_xtr_plugin; RBinLdrPlugin *static_ldr_plugin; diff --git a/libr/bin/format/objc/mach0_classes.c b/libr/bin/format/objc/mach0_classes.c index ab757890d8..db51c4dbd8 100644 --- a/libr/bin/format/objc/mach0_classes.c +++ b/libr/bin/format/objc/mach0_classes.c @@ -1102,7 +1102,7 @@ static void get_class_ro_t(mach0_ut p, RBinFile *bf, ut32 *is_meta_class, RBinCl } } -static mach0_ut get_isa_value() { +static mach0_ut get_isa_value(void) { // TODO: according to otool sources this is taken from relocs return 0; } diff --git a/libr/bin/format/xnu/r_cf_dict.c b/libr/bin/format/xnu/r_cf_dict.c index a333177a1e..ac41869487 100644 --- a/libr/bin/format/xnu/r_cf_dict.c +++ b/libr/bin/format/xnu/r_cf_dict.c @@ -31,11 +31,11 @@ static void r_cf_parse_state_free(RCFParseState *state); static RCFKeyValue *r_cf_key_value_new(char *key, RCFValue *value); static void r_cf_key_value_free(RCFKeyValue *key_value); -static RCFValueDict *r_cf_value_dict_new(); +static RCFValueDict *r_cf_value_dict_new(void); static void r_cf_value_dict_add(RCFValueDict *dict, RCFKeyValue *key_value); static void r_cf_value_dict_print(RCFValueDict *dict); -static RCFValueArray *r_cf_value_array_new(); +static RCFValueArray *r_cf_value_array_new(void); static void r_cf_value_array_free(RCFValueArray *array); static void r_cf_value_array_add(RCFValueArray *array, RCFValue *value); static void r_cf_value_array_print(RCFValueArray *dict); @@ -52,7 +52,7 @@ static RCFValueData *r_cf_value_data_new(char *string); static void r_cf_value_data_free(RCFValueData *data); static void r_cf_value_data_print(RCFValueData *data); -static RCFValueNULL *r_cf_value_null_new(); +static RCFValueNULL *r_cf_value_null_new(void); static void r_cf_value_null_free(RCFValueNULL *null); static void r_cf_value_null_print(RCFValueNULL *null); @@ -334,7 +334,7 @@ static void r_cf_key_value_free(RCFKeyValue *key_value) { R_FREE (key_value); } -static RCFValueDict *r_cf_value_dict_new() { +static RCFValueDict *r_cf_value_dict_new(void) { RCFValueDict *dict = R_NEW0 (RCFValueDict); if (!dict) { return NULL; @@ -381,7 +381,7 @@ static void r_cf_value_dict_print(RCFValueDict *dict) { printf ("}"); } -static RCFValueArray *r_cf_value_array_new() { +static RCFValueArray *r_cf_value_array_new(void) { RCFValueArray *array = R_NEW0 (RCFValueArray); if (!array) { return NULL; @@ -526,7 +526,7 @@ static void r_cf_value_data_print(RCFValueData *data) { printf ("\"...\""); } -static RCFValueNULL *r_cf_value_null_new() { +static RCFValueNULL *r_cf_value_null_new(void) { RCFValueNULL *null = R_NEW0 (RCFValueNULL); if (!null) { return NULL; diff --git a/libr/bin/p/bin_nso.c b/libr/bin/p/bin_nso.c index ce80043850..667fb8866a 100644 --- a/libr/bin/p/bin_nso.c +++ b/libr/bin/p/bin_nso.c @@ -58,7 +58,7 @@ static bool check_buffer(RBuffer *b) { return false; } -static RBinNXOObj *nso_new () { +static RBinNXOObj *nso_new(void) { RBinNXOObj *bin = R_NEW0 (RBinNXOObj); if (bin) { bin->methods_list = r_list_newf ((RListFree)free); diff --git a/libr/bin/p/bin_xnu_kernelcache.c b/libr/bin/p/bin_xnu_kernelcache.c index 7c69336ac0..fd7cf2406b 100644 --- a/libr/bin/p/bin_xnu_kernelcache.c +++ b/libr/bin/p/bin_xnu_kernelcache.c @@ -1303,7 +1303,7 @@ beach: #define K_MIG_ROUTINE_SIZE (5 * 8) #define K_MIG_MAX_ROUTINES 100 -static HtPP *mig_hash_new() { +static HtPP *mig_hash_new(void) { HtPP *hash = sdb_ht_new (); if (!hash) { return NULL; diff --git a/libr/bin/pdb/fpo.c b/libr/bin/pdb/fpo.c index d99e8a2d8c..d291e10b03 100644 --- a/libr/bin/pdb/fpo.c +++ b/libr/bin/pdb/fpo.c @@ -23,8 +23,8 @@ static int parse_fpo_data_v2(char *data, int data_size, int *read_bytes, SFPO_DA { int curr_read_bytes = *read_bytes; - memcpy(fpo_data, data, sizeof(SFPO_DATA_V2)); - *read_bytes += sizeof(SFPO_DATA_V2); + memcpy (fpo_data, data, sizeof(SFPO_DATA_V2)); + *read_bytes += sizeof (SFPO_DATA_V2); return (*read_bytes - curr_read_bytes); } diff --git a/libr/bin/pdb/main.c b/libr/bin/pdb/main.c index 58b27d5623..0b8f06b295 100644 --- a/libr/bin/pdb/main.c +++ b/libr/bin/pdb/main.c @@ -5,7 +5,7 @@ #include /////////////////////////////////////////////////////////////////////////////// -static void print_usage() { +static void print_usage(void) { printf("pdb_parser -f pdb_file [option]\n"); printf("\t -f, --pdb_file : set pdb file to parse\n"); printf("[option]:\n"); diff --git a/libr/bin/pdb/pdb_downloader.c b/libr/bin/pdb/pdb_downloader.c index 5dfab8e011..e1188c83c7 100644 --- a/libr/bin/pdb/pdb_downloader.c +++ b/libr/bin/pdb/pdb_downloader.c @@ -1,21 +1,16 @@ -/* radare - LGPL - Copyright 2014-2017 - inisider */ +/* radare - LGPL - Copyright 2014-2020 - inisider */ #include #include #include #include "pdb_downloader.h" -static bool checkExtract() { +static bool checkExtract(void) { #if __WINDOWS__ - if (r_sys_cmd ("expand -? >nul") != 0) { - return false; - } + return r_sys_cmd ("expand -? >nul") == 0; #else - if (r_sys_cmd ("cabextract -v > /dev/null") != 0) { - return false; - } + return r_sys_cmd ("cabextract -v > /dev/null") == 0; #endif - return true; } static bool download_and_write(SPDBDownloaderOpt *opt, const char *file) { diff --git a/libr/bp/bp.c b/libr/bp/bp.c index 1350552790..7fbe46f51f 100644 --- a/libr/bp/bp.c +++ b/libr/bp/bp.c @@ -1,4 +1,4 @@ -/* radare2 - LGPL - Copyright 2009-2018 - pancake */ +/* radare2 - LGPL - Copyright 2009-2020 - pancake */ #include #include @@ -18,7 +18,7 @@ static void r_bp_item_free (RBreakpointItem *b) { free (b); } -R_API RBreakpoint *r_bp_new() { +R_API RBreakpoint *r_bp_new(void) { int i; RBreakpointPlugin *static_plugin; RBreakpoint *bp = R_NEW0 (RBreakpoint); diff --git a/libr/bp/bp_traptrace.c b/libr/bp/bp_traptrace.c index 0d27a74583..d142780beb 100644 --- a/libr/bp/bp_traptrace.c +++ b/libr/bp/bp_traptrace.c @@ -12,7 +12,7 @@ R_API void r_bp_traptrace_free(void *ptr) { free (trace); } -R_API RList *r_bp_traptrace_new() { +R_API RList *r_bp_traptrace_new(void) { RList *list = r_list_new (); if (!list) { return NULL; diff --git a/libr/bp/bp_watch.c b/libr/bp/bp_watch.c index 9925d55c8a..ca126d2b5f 100644 --- a/libr/bp/bp_watch.c +++ b/libr/bp/bp_watch.c @@ -34,5 +34,5 @@ R_API RBreakpointItem* r_bp_watch_add(RBreakpoint *bp, ut64 addr, int size, int return b; } -R_API void r_bp_watch_del() { +R_API void r_bp_watch_del(void) { } diff --git a/libr/cons/2048.c b/libr/cons/2048.c index f457e3454a..591f04779d 100644 --- a/libr/cons/2048.c +++ b/libr/cons/2048.c @@ -1,4 +1,4 @@ -/* radare2 - LGPL - Copyright 2008-2016 - pancake */ +/* radare2 - LGPL - Copyright 2008-2020 - pancake */ #include @@ -6,7 +6,7 @@ static ut8 twok_buf[4][4]; static int score = 0; static int moves = 0; -static void twok_init() { +static void twok_init(void) { int i, j; score = 0; for (i = 0; i < 4; i++) { @@ -16,7 +16,7 @@ static void twok_init() { } } -static void twok_add() { +static void twok_add(void) { int i, j; while (true) { i = r_num_rand (4); @@ -28,7 +28,7 @@ static void twok_add() { } } -static bool twok_fin() { +static bool twok_fin(void) { int i, j; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { diff --git a/libr/cons/cons.c b/libr/cons/cons.c index c62e00b400..a601028359 100644 --- a/libr/cons/cons.c +++ b/libr/cons/cons.c @@ -274,11 +274,11 @@ R_API void r_cons_strcat_at(const char *_str, int x, char y, int w, int h) { free (str); } -R_API RCons *r_cons_singleton() { +R_API RCons *r_cons_singleton(void) { return &I; } -R_API void r_cons_break_clear() { +R_API void r_cons_break_clear(void) { I.context->breaked = false; } @@ -335,11 +335,11 @@ R_API void r_cons_break_push(RConsBreak cb, void *user) { r_cons_context_break_push (I.context, cb, user, true); } -R_API void r_cons_break_pop() { +R_API void r_cons_break_pop(void) { r_cons_context_break_pop (I.context, true); } -R_API bool r_cons_is_interactive() { +R_API bool r_cons_is_interactive(void) { return I.context->is_interactive; } @@ -347,7 +347,7 @@ R_API bool r_cons_default_context_is_interactive(void) { return r_cons_context_default.is_interactive; } -R_API bool r_cons_is_breaked() { +R_API bool r_cons_is_breaked(void) { if (I.cb_break) { I.cb_break (I.user); } @@ -361,7 +361,7 @@ R_API bool r_cons_is_breaked() { return I.context->breaked; } -R_API int r_cons_get_cur_line() { +R_API int r_cons_get_cur_line(void) { int curline = 0; #if __WINDOWS__ POINT point; @@ -396,7 +396,7 @@ R_API void r_cons_break_timeout(int timeout) { ? r_sys_now () + ((ut64) timeout << 20) : 0; } -R_API void r_cons_break_end() { +R_API void r_cons_break_end(void) { I.context->breaked = false; I.timeout = 0; #if __UNIX__ @@ -507,7 +507,7 @@ R_API bool r_cons_enable_mouse(const bool enable) { // Stub function that cb_main_output gets pointed to in util/log.c by r_cons_new // This allows Cutter to set per-task logging redirection -R_API RCons *r_cons_new() { +R_API RCons *r_cons_new(void) { I.refcnt++; if (I.refcnt != 1) { return &I; @@ -576,7 +576,7 @@ R_API RCons *r_cons_new() { return &I; } -R_API RCons *r_cons_free() { +R_API RCons *r_cons_free(void) { #if __WINDOWS__ r_cons_enable_mouse (false); if (I.old_cp) { @@ -638,7 +638,7 @@ static bool palloc(int moar) { return true; } -R_API int r_cons_eof() { +R_API int r_cons_eof(void) { return feof (I.fdin); } @@ -650,11 +650,11 @@ R_API void r_cons_gotoxy(int x, int y) { #endif } -R_API void r_cons_print_clear() { +R_API void r_cons_print_clear(void) { r_cons_strcat ("\x1b[0;0H\x1b[0m"); } -R_API void r_cons_fill_line() { +R_API void r_cons_fill_line(void) { char *p, white[1024]; int cols = I.columns - 1; if (cols < 1) { @@ -694,16 +694,16 @@ R_API void r_cons_clear_line(int std_err) { fflush (std_err? stderr: stdout); } -R_API void r_cons_clear00() { +R_API void r_cons_clear00(void) { r_cons_clear (); r_cons_gotoxy (0, 0); } -R_API void r_cons_reset_colors() { +R_API void r_cons_reset_colors(void) { r_cons_strcat (Color_RESET_BG Color_RESET); } -R_API void r_cons_clear() { +R_API void r_cons_clear(void) { I.lines = 0; #if __WINDOWS__ r_cons_w32_clear (); @@ -720,7 +720,7 @@ static void cons_grep_reset(RConsGrep *grep) { grep->sort_invert = false; } -R_API void r_cons_reset() { +R_API void r_cons_reset(void) { if (I.context->buffer) { I.context->buffer[0] = '\0'; } @@ -731,16 +731,16 @@ R_API void r_cons_reset() { CTX (pageable) = true; } -R_API const char *r_cons_get_buffer() { +R_API const char *r_cons_get_buffer(void) { //check len otherwise it will return trash return I.context->buffer_len? I.context->buffer : NULL; } -R_API int r_cons_get_buffer_len() { +R_API int r_cons_get_buffer_len(void) { return I.context->buffer_len; } -R_API void r_cons_filter() { +R_API void r_cons_filter(void) { /* grep */ if (I.filter || I.context->grep.nstrings > 0 || I.context->grep.tokens_used || I.context->grep.less || I.context->grep.json) { (void)r_cons_grepbuf (); @@ -760,7 +760,7 @@ R_API void r_cons_filter() { /* TODO */ } -R_API void r_cons_push() { +R_API void r_cons_push(void) { if (!I.context->cons_stack) { return; } @@ -775,7 +775,7 @@ R_API void r_cons_push() { } } -R_API void r_cons_pop() { +R_API void r_cons_pop(void) { if (!I.context->cons_stack) { return; } @@ -808,11 +808,11 @@ R_API void r_cons_context_load(RConsContext *context) { I.context = context; } -R_API void r_cons_context_reset() { +R_API void r_cons_context_reset(void) { I.context = &r_cons_context_default; } -R_API bool r_cons_context_is_main() { +R_API bool r_cons_context_is_main(void) { return I.context == &r_cons_context_default; } @@ -834,7 +834,7 @@ R_API void r_cons_last(void) { r_cons_memcat (CTX (lastOutput), CTX (lastLength)); } -static bool lastMatters() { +static bool lastMatters(void) { return (I.context->buffer_len > 0) \ && (CTX (lastEnabled) && !I.filter && I.context->grep.nstrings < 1 && \ !I.context->grep.tokens_used && !I.context->grep.less && \ @@ -969,7 +969,7 @@ R_API void r_cons_flush(void) { } } -R_API void r_cons_visual_flush() { +R_API void r_cons_visual_flush(void) { if (I.noflush) { return; } @@ -1152,7 +1152,7 @@ R_API int r_cons_printf(const char *format, ...) { return 0; } -R_API int r_cons_get_column() { +R_API int r_cons_get_column(void) { char *line = strrchr (I.context->buffer, '\n'); if (!line) { line = I.context->buffer; @@ -1212,7 +1212,7 @@ R_API void r_cons_strcat(const char *str) { } } -R_API void r_cons_newline() { +R_API void r_cons_newline(void) { if (!I.null) { r_cons_strcat ("\n"); } @@ -1266,7 +1266,7 @@ R_API int r_cons_get_cursor(int *rows) { return col; } -R_API bool r_cons_isatty() { +R_API bool r_cons_isatty(void) { #if __UNIX__ struct winsize win = { 0 }; const char *tty; @@ -1663,7 +1663,7 @@ R_API void r_cons_set_interactive(bool x) { r_cons_singleton ()->context->is_interactive = x; } -R_API void r_cons_set_last_interactive() { +R_API void r_cons_set_last_interactive(void) { r_cons_singleton ()->context->is_interactive = lasti; } @@ -1671,7 +1671,7 @@ R_API void r_cons_set_title(const char *str) { r_cons_printf ("\x1b]0;%s\007", str); } -R_API void r_cons_zero() { +R_API void r_cons_zero(void) { if (I.line) { I.line->zerosep = true; } @@ -1821,7 +1821,7 @@ R_API bool r_cons_drop(int n) { return true; } -R_API void r_cons_chop() { +R_API void r_cons_chop(void) { while (I.context->buffer_len > 0) { char ch = I.context->buffer[I.context->buffer_len - 1]; if (ch != '\n' && !IS_WHITESPACE (ch)) { diff --git a/libr/cons/cutf8.c b/libr/cons/cutf8.c index 69839e2356..4e6d4f22dd 100644 --- a/libr/cons/cutf8.c +++ b/libr/cons/cutf8.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2015-2019 - pancake */ +/* radare - LGPL - Copyright 2015-2020 - pancake */ // Copypasta from http://www.linuxquestions.org/questions/programming-9/get-cursor-position-in-c-947833/ #include @@ -191,7 +191,7 @@ static int cursor_position(const int tty, int *const rowptr, int *const colptr) } #endif -R_API bool r_cons_is_utf8() { +R_API bool r_cons_is_utf8(void) { bool ret = false; #if UTF8_DETECT_ENV const char *keys[] = { "LC_ALL", "LC_CTYPE", "LANG", NULL }; @@ -217,7 +217,7 @@ R_API bool r_cons_is_utf8() { #if UTF8_DETECT_CURSOR int row = 0, col = 0; int row2 = 0, col2 = 0; - int fd = current_tty(); + int fd = current_tty (); if (fd == -1) return false; if (cursor_position(fd, &row, &col)) { @@ -236,7 +236,7 @@ R_API bool r_cons_is_utf8() { return ret; } #else -R_API bool r_cons_is_utf8() { +R_API bool r_cons_is_utf8(void) { #if __WINDOWS__ return GetConsoleOutputCP () == CP_UTF8; #else diff --git a/libr/cons/dietline.c b/libr/cons/dietline.c index 15e6888b5c..d1248338c0 100644 --- a/libr/cons/dietline.c +++ b/libr/cons/dietline.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2007-2019 - pancake */ +/* radare - LGPL - Copyright 2007-2020 - pancake */ /* dietline is a lightweight and portable library similar to GNU readline */ #include @@ -46,7 +46,7 @@ static inline bool is_word_break_char(char ch, bool mode) { } /* https://www.gnu.org/software/bash/manual/html_node/Commands-For-Killing.html */ -static void backward_kill_word() { +static void backward_kill_word(void) { int i, len; if (I.buffer.index > 0) { for (i = I.buffer.index; i > 0 && is_word_break_char (I.buffer.data[i], MINOR_BREAK); i--) { @@ -74,7 +74,7 @@ static void backward_kill_word() { } } -static void backward_kill_Word() { +static void backward_kill_Word(void) { int i, len; if (I.buffer.index > 0) { for (i = I.buffer.index; i > 0 && is_word_break_char (I.buffer.data[i], MAJOR_BREAK); i--) { @@ -102,7 +102,7 @@ static void backward_kill_Word() { } } -static void kill_word() { +static void kill_word(void) { int i, len; for (i = I.buffer.index; i < I.buffer.length && is_word_break_char (I.buffer.data[i], MINOR_BREAK); i++) { /* Move the cursor index forward until we hit a non-word-break-character */ @@ -121,7 +121,7 @@ static void kill_word() { I.buffer.length = strlen (I.buffer.data); } -static void kill_Word() { +static void kill_Word(void) { int i, len; for (i = I.buffer.index; i < I.buffer.length && is_word_break_char (I.buffer.data[i], MAJOR_BREAK); i++) { /* Move the cursor index forward until we hit a non-word-break-character */ @@ -140,7 +140,7 @@ static void kill_Word() { I.buffer.length = strlen (I.buffer.data); } -static void paste() { +static void paste(void) { if (I.clipboard) { char *cursor = I.buffer.data + I.buffer.index; int dist = (I.buffer.data + I.buffer.length) - cursor; @@ -153,7 +153,7 @@ static void paste() { } } -static void unix_word_rubout() { +static void unix_word_rubout(void) { int i, len; if (I.buffer.index > 0) { for (i = I.buffer.index - 1; i > 0 && I.buffer.data[i] == ' '; i--) { @@ -184,7 +184,7 @@ static void unix_word_rubout() { } } -static int inithist() { +static int inithist(void) { ZERO_FILL (I.history); if ((I.history.size + 1024) * sizeof (char *) < I.history.size) { return false; @@ -198,7 +198,7 @@ static int inithist() { } /* initialize history stuff */ -R_API int r_line_dietline_init() { +R_API int r_line_dietline_init(void) { ZERO_FILL (I.completion); if (!inithist ()) { return false; @@ -410,14 +410,14 @@ R_API int r_line_hist_add(const char *line) { return true; } -static int r_line_hist_up() { +static int r_line_hist_up(void) { if (!I.cb_history_up) { r_line_set_hist_callback (&I, &r_line_hist_cmd_up, &r_line_hist_cmd_down); } return I.cb_history_up (&I); } -static int r_line_hist_down() { +static int r_line_hist_down(void) { if (!I.cb_history_down) { r_line_set_hist_callback (&I, &r_line_hist_cmd_up, &r_line_hist_cmd_down); } @@ -440,7 +440,7 @@ R_API const char *r_line_hist_get(int n) { return NULL; } -R_API int r_line_hist_list() { +R_API int r_line_hist_list(void) { int i = 0; if (!I.history.data) { inithist (); @@ -454,7 +454,7 @@ R_API int r_line_hist_list() { return i; } -R_API void r_line_hist_free() { +R_API void r_line_hist_free(void) { int i; if (I.history.data) { for (i = 0; i < I.history.size; i++) { @@ -527,7 +527,7 @@ R_API int r_line_hist_chop(const char *file, int limit) { return 0; } -static void selection_widget_draw() { +static void selection_widget_draw(void) { RCons *cons = r_cons_singleton (); RSelWidget *sel_widget = I.sel_widget; int y, pos_y, pos_x = r_str_ansi_len (I.prompt); @@ -627,7 +627,7 @@ static void print_rline_task(void *core) { r_cons_flush (); } -static void selection_widget_erase() { +static void selection_widget_erase(void) { RSelWidget *sel_widget = I.sel_widget; if (sel_widget) { sel_widget->options_len = 0; @@ -646,7 +646,7 @@ static void selection_widget_erase() { } } -static void selection_widget_select() { +static void selection_widget_select(void) { RSelWidget *sel_widget = I.sel_widget; if (sel_widget && sel_widget->selection < sel_widget->options_len) { char *sp = strchr (I.buffer.data, ' '); @@ -665,7 +665,7 @@ static void selection_widget_select() { } } -static void selection_widget_update() { +static void selection_widget_update(void) { int argc = r_pvector_len (&I.completion.args); const char **argv = (const char **)r_pvector_data (&I.completion.args); if (argc == 0 || (argc == 1 && I.buffer.length >= strlen (argv[0]))) { @@ -692,7 +692,7 @@ static void selection_widget_update() { return; } -R_API void r_line_autocomplete() { +R_API void r_line_autocomplete(void) { char *p; const char **argv = NULL; int argc = 0, i, j, plen, len = 0; @@ -832,11 +832,11 @@ R_API void r_line_autocomplete() { fflush (stdout); } -R_API const char *r_line_readline() { +R_API const char *r_line_readline(void) { return r_line_readline_cb (NULL, NULL); } -static inline void rotate_kill_ring() { +static inline void rotate_kill_ring(void) { if (enable_yank_pop) { I.buffer.index -= strlen (r_list_get_n (I.kill_ring, I.kill_ring_ptr)); I.buffer.data[I.buffer.index] = 0; @@ -849,7 +849,7 @@ static inline void rotate_kill_ring() { } } -static inline void __delete_next_char() { +static inline void __delete_next_char(void) { if (I.buffer.index < I.buffer.length) { int len = r_str_utf8_charsize (I.buffer.data + I.buffer.index); memmove (I.buffer.data + I.buffer.index, @@ -859,7 +859,7 @@ static inline void __delete_next_char() { } } -static inline void __delete_prev_char() { +static inline void __delete_prev_char(void) { if (I.buffer.index < I.buffer.length) { if (I.buffer.index > 0) { size_t len = r_str_utf8_charsize_prev (I.buffer.data + I.buffer.index, I.buffer.index); @@ -882,13 +882,13 @@ static inline void __delete_prev_char() { } } -static inline void delete_till_end() { +static inline void delete_till_end(void) { I.buffer.data[I.buffer.index] = '\0'; I.buffer.length = I.buffer.index; I.buffer.index = I.buffer.index > 0 ? I.buffer.index - 1 : 0; } -static void __print_prompt() { +static void __print_prompt(void) { RCons *cons = r_cons_singleton (); int columns = r_cons_get_size (NULL) - 2; int chars = R_MAX (1, strlen (I.buffer.data)); @@ -917,19 +917,19 @@ static void __print_prompt() { fflush (stdout); } -static inline void __move_cursor_right() { +static inline void __move_cursor_right(void) { I.buffer.index = I.buffer.index < I.buffer.length ? I.buffer.index + r_str_utf8_charsize (I.buffer.data + I.buffer.index) : I.buffer.length; } -static inline void __move_cursor_left() { +static inline void __move_cursor_left(void) { I.buffer.index = I.buffer.index ? I.buffer.index - r_str_utf8_charsize_prev (I.buffer.data + I.buffer.index, I.buffer.index) : 0; } -static inline void vi_cmd_b() { +static inline void vi_cmd_b(void) { int i; for (i = I.buffer.index - 2; i >= 0; i--) { if ((is_word_break_char (I.buffer.data[i], MINOR_BREAK) @@ -945,7 +945,7 @@ static inline void vi_cmd_b() { } } -static inline void vi_cmd_B() { +static inline void vi_cmd_B(void) { int i; for (i = I.buffer.index - 2; i >= 0; i--) { if ((!is_word_break_char (I.buffer.data[i], MAJOR_BREAK) @@ -959,7 +959,7 @@ static inline void vi_cmd_B() { } } -static inline void vi_cmd_W() { +static inline void vi_cmd_W(void) { int i; for (i = I.buffer.index + 1; i < I.buffer.length; i++) { if ((!is_word_break_char (I.buffer.data[i], MAJOR_BREAK) @@ -973,7 +973,7 @@ static inline void vi_cmd_W() { } } -static inline void vi_cmd_w() { +static inline void vi_cmd_w(void) { int i; for (i = I.buffer.index + 1; i < I.buffer.length; i++) { if ((!is_word_break_char (I.buffer.data[i], MINOR_BREAK) @@ -989,7 +989,7 @@ static inline void vi_cmd_w() { } } -static inline void vi_cmd_E() { +static inline void vi_cmd_E(void) { int i; for (i = I.buffer.index + 1; i < I.buffer.length; i++) { if ((!is_word_break_char (I.buffer.data[i], MAJOR_BREAK) @@ -1003,7 +1003,7 @@ static inline void vi_cmd_E() { } } -static inline void vi_cmd_e() { +static inline void vi_cmd_e(void) { int i; for (i = I.buffer.index + 1; i < I.buffer.length; i++) { if ((!is_word_break_char (I.buffer.data[i], MINOR_BREAK) @@ -1019,7 +1019,7 @@ static inline void vi_cmd_e() { } } -static void __update_prompt_color () { +static void __update_prompt_color (void) { RCons *cons = r_cons_singleton (); const char *BEGIN = "", *END = ""; if (cons->context->color_mode) { @@ -1043,7 +1043,7 @@ static void __update_prompt_color () { I.prompt = r_str_newf ("%s%s%s", BEGIN, prompt, END); } -static void __vi_mode() { +static void __vi_mode(void) { char ch; I.vi_mode = CONTROL_MODE; __update_prompt_color (); diff --git a/libr/cons/editor.c b/libr/cons/editor.c index fcc9f60ca0..8dbba5b10d 100644 --- a/libr/cons/editor.c +++ b/libr/cons/editor.c @@ -44,7 +44,7 @@ static int down(void *n) { return -1; } -static void filesave() { +static void filesave(void) { char buf[128]; int i; if (!path) { diff --git a/libr/cons/grep.c b/libr/cons/grep.c index db33be9677..7d4fffe2f8 100644 --- a/libr/cons/grep.c +++ b/libr/cons/grep.c @@ -1,7 +1,6 @@ /* radare - LGPL - Copyright 2009-2020 - pancake, nibble */ #include -#include #include #include @@ -458,7 +457,7 @@ static int cmp(const void *a, const void *b) { return strcmp (a, b); } -R_API void r_cons_grepbuf() { +R_API void r_cons_grepbuf(void) { RCons *cons = r_cons_singleton (); const char *buf = cons->context->buffer; const int len = cons->context->buffer_len; diff --git a/libr/cons/input.c b/libr/cons/input.c index 6c5749f07a..f7a36d354d 100644 --- a/libr/cons/input.c +++ b/libr/cons/input.c @@ -48,7 +48,7 @@ R_API int r_cons_controlz(int ch) { // 97 - wheel down // 95 - mouse up // 92 - mouse down -static int __parseMouseEvent() { +static int __parseMouseEvent(void) { char xpos[32]; char ypos[32]; (void)r_cons_readchar (); // skip first char @@ -585,7 +585,7 @@ R_API bool r_cons_readpush(const char *str, int len) { return false; } -R_API void r_cons_readflush() { +R_API void r_cons_readflush(void) { R_FREE (readbuffer); readbuffer_length = 0; } @@ -598,7 +598,7 @@ R_API void r_cons_switchbuf(bool active) { extern volatile sig_atomic_t sigwinchFlag; #endif -R_API int r_cons_readchar() { +R_API int r_cons_readchar(void) { char buf[2]; buf[0] = -1; if (readbuffer_length > 0) { diff --git a/libr/cons/more.c b/libr/cons/more.c index bdca905125..bcad22f5f4 100644 --- a/libr/cons/more.c +++ b/libr/cons/more.c @@ -140,6 +140,6 @@ R_API int r_cons_more_str(const char *str, const char *exitkeys) { return 0; } -R_API void r_cons_more() { +R_API void r_cons_more(void) { (void)r_cons_more_str (r_cons_singleton ()->context->buffer, NULL); } diff --git a/libr/cons/pal.c b/libr/cons/pal.c index d19faa7a92..8e9b6eb416 100644 --- a/libr/cons/pal.c +++ b/libr/cons/pal.c @@ -266,7 +266,7 @@ R_API void r_cons_pal_copy(RConsContext *dst, RConsContext *src) { __cons_pal_update_event (dst); } -R_API void r_cons_pal_random() { +R_API void r_cons_pal_random(void) { int i; RColor *rcolor; for (i = 0; keys[i].name; i++) { @@ -417,7 +417,7 @@ R_API char *r_cons_pal_parse(const char *str, RColor *outcol) { return (*out && !outcol) ? strdup (out) : NULL; } -static void r_cons_pal_show_gs() { +static void r_cons_pal_show_gs(void) { int i, n; r_cons_print ("\nGreyscale:\n"); RColor rcolor = RColor_BLACK; @@ -442,7 +442,7 @@ static void r_cons_pal_show_gs() { } } -static void r_cons_pal_show_256() { +static void r_cons_pal_show_256(void) { RColor rc = RColor_BLACK; r_cons_print ("\n\nXTerm colors:\n"); int r = 0; @@ -474,7 +474,7 @@ static void r_cons_pal_show_256() { } } -static void r_cons_pal_show_rgb() { +static void r_cons_pal_show_rgb(void) { const int inc = 3; int i, j, k, n = 0; RColor rc = RColor_BLACK; @@ -500,7 +500,7 @@ static void r_cons_pal_show_rgb() { } } -R_API void r_cons_pal_show() { +R_API void r_cons_pal_show(void) { int i; for (i = 0; colors[i].name; i++) { r_cons_printf ("%s%s__"Color_RESET" %s\n", @@ -648,11 +648,11 @@ R_API const char *r_cons_pal_get_name(int index) { return (index >= 0 && index < keys_len) ? keys[index].name : NULL; } -R_API int r_cons_pal_len() { +R_API int r_cons_pal_len(void) { return keys_len; } -R_API void r_cons_pal_update_event() { +R_API void r_cons_pal_update_event(void) { __cons_pal_update_event (r_cons_singleton ()->context); } diff --git a/libr/cons/rgb.c b/libr/cons/rgb.c index 0f6e9182fb..decafb854a 100644 --- a/libr/cons/rgb.c +++ b/libr/cons/rgb.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2013-2019 - pancake, xarkes */ +/* radare - LGPL - Copyright 2013-2020 - pancake, xarkes */ /* ansi 256 color extension for r_cons */ /* https://en.wikipedia.org/wiki/ANSI_color */ @@ -7,7 +7,7 @@ int color_table[256] = { 0 }; int value_range[6] = { 0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff}; -static void init_color_table() { +static void init_color_table(void) { int i, r, g, b; // ansi colors color_table[0] = 0x000000; diff --git a/libr/core/casm.c b/libr/core/casm.c index 6d4bf08b18..ce43abb324 100644 --- a/libr/core/casm.c +++ b/libr/core/casm.c @@ -23,7 +23,7 @@ static int rcoreasm_address_comparator(RCoreAsmHit *a, RCoreAsmHit *b){ return 1; /* a->addr > b->addr */ } -R_API RCoreAsmHit *r_core_asm_hit_new() { +R_API RCoreAsmHit *r_core_asm_hit_new(void) { RCoreAsmHit *hit = R_NEW0 (RCoreAsmHit); if (!hit) { return NULL; @@ -33,7 +33,7 @@ R_API RCoreAsmHit *r_core_asm_hit_new() { return hit; } -R_API RList *r_core_asm_hit_list_new() { +R_API RList *r_core_asm_hit_list_new(void) { RList *list = r_list_new (); if (list) { list->free = &r_core_asm_hit_free; diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index a10f4304f3..02a8aaff65 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -7921,7 +7921,7 @@ static void agraph_print_node(RANode *n, void *user) { free (encbody); } -static char *getViewerPath() { +static char *getViewerPath(void) { int i; const char *viewers[] = { #if __WINDOWS__ diff --git a/libr/core/cmd_api.c b/libr/core/cmd_api.c index 2b2c7985c1..0db54b71f0 100644 --- a/libr/core/cmd_api.c +++ b/libr/core/cmd_api.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2009-2019 - pancake */ +/* radare - LGPL - Copyright 2009-2020 - pancake */ #include #include @@ -50,7 +50,7 @@ R_API void r_cmd_alias_init(RCmd *cmd) { cmd->aliases.values = NULL; } -R_API RCmd *r_cmd_new () { +R_API RCmd *r_cmd_new(void) { int i; RCmd *cmd = R_NEW0 (RCmd); if (!cmd) { @@ -357,7 +357,7 @@ R_API RCmdStatus r_cmd_call_parsed_args(RCmd *cmd, RCmdParsedArgs *args) { /** macro.c **/ -R_API RCmdMacroItem *r_cmd_macro_item_new() { +R_API RCmdMacroItem *r_cmd_macro_item_new(void) { return R_NEW0 (RCmdMacroItem); } diff --git a/libr/core/cmd_eval.c b/libr/core/cmd_eval.c index 5a4c2d430f..fe648cc2e9 100644 --- a/libr/core/cmd_eval.c +++ b/libr/core/cmd_eval.c @@ -169,7 +169,7 @@ static void list_themes_in_path(RList *list, const char *path) { r_list_free (files); } -R_API char *r_core_get_theme () { +R_API char *r_core_get_theme (void) { return curtheme; } diff --git a/libr/core/core.c b/libr/core/core.c index c4eed0be5b..7606ee07f8 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -823,7 +823,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) { return ret; } -R_API RCore *r_core_new() { +R_API RCore *r_core_new(void) { RCore *c = R_NEW0 (RCore); if (c) { r_core_init (c); diff --git a/libr/core/corelog.c b/libr/core/corelog.c index c8aa4a53df..6b3dec9b2a 100644 --- a/libr/core/corelog.c +++ b/libr/core/corelog.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2009-2019 - pancake */ +/* radare - LGPL - Copyright 2009-2020 - pancake */ #include @@ -46,7 +46,7 @@ R_API int r_core_log_list(RCore *core, int n, int nth, char fmt) { return count; } -R_API RCoreLog *r_core_log_new() { +R_API RCoreLog *r_core_log_new(void) { RCoreLog *log = R_NEW0 (RCoreLog); if (!log) { return NULL; diff --git a/libr/core/p/core_test.c b/libr/core/p/core_test.c index 2515310d4c..16e91af0f6 100644 --- a/libr/core/p/core_test.c +++ b/libr/core/p/core_test.c @@ -18,7 +18,7 @@ mv core_test.so ~/.config/radare2/plugins #undef R_IPI #define R_IPI static -static int r_cmd_test_call() { +static int r_cmd_test_call(void) { eprintf ("Dummy!\n"); return false; } diff --git a/libr/core/panels.c b/libr/core/panels.c index 0e5c8a9d08..75510ccb7f 100644 --- a/libr/core/panels.c +++ b/libr/core/panels.c @@ -469,7 +469,7 @@ static void __delete_almighty(RCore *core, RModal *modal, Sdb *menu_db); static void __create_almighty(RCore *core, RPanel *panel, Sdb *menu_db); static void __update_modal(RCore *core, Sdb *menu_db, RModal *modal); static bool __draw_modal(RCore *core, RModal *modal, int range_end, int start, const char *name); -static RModal *__init_modal(); +static RModal *__init_modal(void); static void __free_modal(RModal **modal); /* menu callback */ @@ -575,7 +575,7 @@ static int cmpstr(const void *_a, const void *_b); static RList *__sorted_list(RCore *core, char *menu[], int count); /* config */ -static char *__get_panels_config_dir_path(); +static char *__get_panels_config_dir_path(void); static char *__create_panels_config_path(const char *file); static void __load_config_menu(RCore *core); static char *__parse_panels_config(const char *cfg, int len); @@ -4884,7 +4884,7 @@ bool __init_panels(RCore *core, RPanels *panels) { return true; } -RModal *__init_modal() { +RModal *__init_modal(void) { RModal *modal = R_NEW0 (RModal); if (!modal) { return NULL; @@ -5611,7 +5611,7 @@ void __restore_panel_pos(RPanel* panel) { panel->view->prevPos.w, panel->view->prevPos.h); } -char *__get_panels_config_dir_path() { +char *__get_panels_config_dir_path(void) { return r_str_home (R_JOIN_2_PATHS (R2_HOME_DATADIR, ".r2panels")); } diff --git a/libr/core/visual.c b/libr/core/visual.c index 3a43223775..84a33d58b6 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -2273,7 +2273,7 @@ static void numbuf_append(int ch) { numbuf[numbuf_i] = 0; } -static int numbuf_pull() { +static int numbuf_pull(void) { int distance = 1; if (numbuf_i) { numbuf[numbuf_i] = 0; diff --git a/libr/core/windows_heap.c b/libr/core/windows_heap.c index e27d503cd5..0b61fc73c5 100644 --- a/libr/core/windows_heap.c +++ b/libr/core/windows_heap.c @@ -74,7 +74,7 @@ static size_t RtlpLFHKeyOffset = 0; }\ hb->dwFlags |= ((flags) >> SHIFT) << SHIFT; -static bool __is_windows_ten() { +static bool __is_windows_ten(void) { int major = 0; RSysInfo *info = r_sys_info (); if (info && info->version) { @@ -120,7 +120,7 @@ static char *get_type(WPARAM flags) { return r_str_newf ("%s %s%s", state, heaptype, type); } -static bool init_func() { +static bool init_func(void) { HANDLE ntdll = LoadLibrary (TEXT ("ntdll.dll")); if (!ntdll) { return false; @@ -1166,7 +1166,7 @@ err: return NULL; } -static RTable *__new_heapblock_tbl() { +static RTable *__new_heapblock_tbl(void) { RTable *tbl = r_table_new (); r_table_add_column (tbl, r_table_type ("number"), "HeaderAddress", -1); r_table_add_column (tbl, r_table_type ("number"), "UserAddress", -1); diff --git a/libr/crypto/crypto.c b/libr/crypto/crypto.c index 4da3f7c5f4..bb99d956ae 100644 --- a/libr/crypto/crypto.c +++ b/libr/crypto/crypto.c @@ -72,7 +72,7 @@ R_API RCrypto *r_crypto_init(RCrypto *cry, int hard) { // first call initializes the output_* variables r_crypto_get_output (cry, NULL); cry->plugins = r_list_newf (NULL); - for (i=0; crypto_static_plugins[i]; i++) { + for (i = 0; crypto_static_plugins[i]; i++) { RCryptoPlugin *p = R_NEW0 (RCryptoPlugin); if (!p) { free (cry); @@ -97,7 +97,7 @@ R_API int r_crypto_del(RCrypto *cry, RCryptoPlugin *h) { return true; } -R_API struct r_crypto_t *r_crypto_new() { +R_API struct r_crypto_t *r_crypto_new(void) { RCrypto *cry = R_NEW0 (RCrypto); return r_crypto_init (cry, true); } diff --git a/libr/debug/dmap.c b/libr/debug/dmap.c index a94e83cbc1..8c80304ade 100644 --- a/libr/debug/dmap.c +++ b/libr/debug/dmap.c @@ -349,7 +349,7 @@ R_API void r_debug_map_free(RDebugMap *map) { free (map); } -R_API RList *r_debug_map_list_new() { +R_API RList *r_debug_map_list_new(void) { RList *list = r_list_new (); if (!list) { return NULL; diff --git a/libr/debug/p/debug_native.c b/libr/debug/p/debug_native.c index 826a2eaa53..4a7e3b2bde 100644 --- a/libr/debug/p/debug_native.c +++ b/libr/debug/p/debug_native.c @@ -1472,7 +1472,7 @@ static int r_debug_native_bp(RBreakpoint *bp, RBreakpointItem *b, bool set) { #if __APPLE__ -static int getMaxFiles() { +static int getMaxFiles(void) { struct rlimit limit; if (getrlimit (RLIMIT_NOFILE, &limit) != 0) { return 1024; diff --git a/libr/debug/p/native/w32.c b/libr/debug/p/native/w32.c index df51824cab..47da39b51b 100644 --- a/libr/debug/p/native/w32.c +++ b/libr/debug/p/native/w32.c @@ -1,6 +1,6 @@ #include "w32.h" -static bool w32dbg_SeDebugPrivilege() { +static bool w32dbg_SeDebugPrivilege(void) { ///////////////////////////////////////////////////////// // Note: Enabling SeDebugPrivilege adapted from sample // MSDN @ http://msdn.microsoft.com/en-us/library/aa446619%28VS.85%29.aspx @@ -36,7 +36,7 @@ static bool w32dbg_SeDebugPrivilege() { return ret; } -int w32_dbg_init() { +int w32_dbg_init(void) { HANDLE lib; // escalate privs (required for win7/vista) @@ -297,11 +297,11 @@ err_get_file_name_from_handle: LPVOID lstLib = 0; PLIB_ITEM lstLibPtr = 0; /* -static char * r_debug_get_dll() { +static char * r_debug_get_dll(void) { return lstLibPtr->Path; } */ -static PLIB_ITEM r_debug_get_lib_item() { +static PLIB_ITEM r_debug_get_lib_item(void) { return lstLibPtr; } #define PLIB_MAX 512 @@ -344,7 +344,7 @@ static void * r_debug_findlib (void * BaseOfDll) { LPVOID lstThread = 0; PTHREAD_ITEM lstThreadPtr = 0; -static PTHREAD_ITEM r_debug_get_thread_item () { +static PTHREAD_ITEM r_debug_get_thread_item (void) { return lstThreadPtr; } #define PTHREAD_MAX 1024 diff --git a/libr/debug/p/native/windows/windows_debug.c b/libr/debug/p/native/windows/windows_debug.c index 528813fc1e..8e8b1600fe 100644 --- a/libr/debug/p/native/windows/windows_debug.c +++ b/libr/debug/p/native/windows/windows_debug.c @@ -869,12 +869,12 @@ static int __debug_exception_event(DEBUG_EVENT *de) { } #if 0 -static char *__r_debug_get_dll() { +static char *__r_debug_get_dll(void) { return lstLibPtr->Path; } #endif -static PLIB_ITEM __r_debug_get_lib_item() { +static PLIB_ITEM __r_debug_get_lib_item(void) { return lstLibPtr; } diff --git a/libr/debug/p/native/xnu/xnu_debug.c b/libr/debug/p/native/xnu/xnu_debug.c index 834703de03..18a3124c2b 100644 --- a/libr/debug/p/native/xnu/xnu_debug.c +++ b/libr/debug/p/native/xnu/xnu_debug.c @@ -687,7 +687,7 @@ static cpu_type_t xnu_get_cpu_type (pid_t pid) { return -1; } -static cpu_subtype_t xnu_get_cpu_subtype () { +static cpu_subtype_t xnu_get_cpu_subtype (void) { size_t size; cpu_subtype_t subtype; diff --git a/libr/debug/snap.c b/libr/debug/snap.c index ab952a07cb..72087e657b 100644 --- a/libr/debug/snap.c +++ b/libr/debug/snap.c @@ -1,8 +1,8 @@ -/* radare - LGPL - Copyright 2015-2017 - pancake, rkx1209 */ +/* radare - LGPL - Copyright 2015-2020 - pancake, rkx1209 */ #include -R_API RDebugSnap *r_debug_snap_new() { +R_API RDebugSnap *r_debug_snap_new(void) { RDebugSnap *snap = R_NEW0 (RDebugSnap); ut64 algobit = r_hash_name_to_bits ("sha256"); if (!snap) { diff --git a/libr/debug/trace.c b/libr/debug/trace.c index 18e44399d1..04cc8d254e 100644 --- a/libr/debug/trace.c +++ b/libr/debug/trace.c @@ -1,10 +1,10 @@ -/* radare - LGPL - Copyright 2008-2019 - pancake */ +/* radare - LGPL - Copyright 2008-2020 - pancake */ #include // DO IT WITH SDB -R_API RDebugTrace *r_debug_trace_new () { +R_API RDebugTrace *r_debug_trace_new (void) { RDebugTrace *t = R_NEW0 (RDebugTrace); if (!t) { return NULL; diff --git a/libr/egg/egg.c b/libr/egg/egg.c index 6380d40e43..bd23ba200b 100644 --- a/libr/egg/egg.c +++ b/libr/egg/egg.c @@ -25,7 +25,7 @@ void egg_patch_free (void *p) { free (ep); } -R_API REgg *r_egg_new() { +R_API REgg *r_egg_new(void) { int i; REgg *egg = R_NEW0 (REgg); if (!egg) { diff --git a/libr/egg/egg_lang.c b/libr/egg/egg_lang.c index a962cf9516..5ef2ac1e34 100644 --- a/libr/egg/egg_lang.c +++ b/libr/egg/egg_lang.c @@ -733,7 +733,7 @@ static void rcc_fun(REgg *egg, const char *str) { } #if 0 -static void shownested() { +static void shownested(void) { int i; eprintf ("[[[NESTED %d]]] ", context); for (i = 0; egg->lang.nested[i]; i++) { @@ -818,7 +818,6 @@ static void rcc_context(REgg *egg, int delta) { // eprintf ("END BLOCK %d, (%s)\n", context, egg->lang.nested[context-1]); // eprintf ("CN = (%s) %d (%s) delta=%d\n", cn, context, egg->lang.nested[context-1], delta); if (egg->lang.callname) { - // if (callname) { // handle 'foo() {' /* TODO: this must be an array */ char *b, *g, *e, *n; emit->comment (egg, "cond frame %s (%s)", egg->lang.callname, elm); diff --git a/libr/flag/flag.c b/libr/flag/flag.c index 891f0e9c89..1aabfb4bba 100644 --- a/libr/flag/flag.c +++ b/libr/flag/flag.c @@ -215,7 +215,7 @@ static void new_spaces(RFlag *f) { r_event_hook (f->spaces.event, R_SPACE_EVENT_UNSET, unset_flagspace, NULL); } -R_API RFlag *r_flag_new() { +R_API RFlag *r_flag_new(void) { RFlag *f = R_NEW0 (RFlag); if (!f) { return NULL; diff --git a/libr/fs/fs.c b/libr/fs/fs.c index be89a88d44..f47be6c489 100644 --- a/libr/fs/fs.c +++ b/libr/fs/fs.c @@ -18,7 +18,7 @@ static RFSPlugin* fs_static_plugins[] = { R_FS_STATIC_PLUGINS }; -R_API RFS* r_fs_new() { +R_API RFS* r_fs_new(void) { int i; RFSPlugin* static_plugin; RFS* fs = R_NEW0 (RFS); @@ -574,7 +574,7 @@ R_API const char* r_fs_partition_type_get(int n) { return partitions[n].name; } -R_API int r_fs_partition_get_size() { +R_API int r_fs_partition_get_size(void) { return R_FS_PARTITIONS_LENGTH; } diff --git a/libr/include/r_types.h b/libr/include/r_types.h index 27c7ec5a0d..9e557232d5 100644 --- a/libr/include/r_types.h +++ b/libr/include/r_types.h @@ -288,7 +288,7 @@ typedef int (*PrintfCallback)(const char *str, ...); #define R_LIB_VERSION_HEADER(x) \ R_API const char *x##_version(void) #define R_LIB_VERSION(x) \ -R_API const char *x##_version() { return "" R2_GITTAP; } +R_API const char *x##_version(void) { return "" R2_GITTAP; } #define BITS2BYTES(x) (((x)/8)+(((x)%8)?1:0)) #define ZERO_FILL(x) memset (&x, 0, sizeof (x)) diff --git a/libr/io/io.c b/libr/io/io.c index 7b02dfdf3e..63e5310239 100644 --- a/libr/io/io.c +++ b/libr/io/io.c @@ -98,7 +98,7 @@ static st64 on_map_skyline(RIO *io, ut64 vaddr, ut8 *buf, int len, int match_flg return prefix_mode ? addr - vaddr : ret; } -R_API RIO* r_io_new() { +R_API RIO* r_io_new(void) { return r_io_init (R_NEW0 (RIO)); } diff --git a/libr/io/p/io_debug.c b/libr/io/p/io_debug.c index 749e84be4b..c7e785edd9 100644 --- a/libr/io/p/io_debug.c +++ b/libr/io/p/io_debug.c @@ -68,7 +68,7 @@ typedef struct { static ut64 winbase; //HACK static int wintid; -static int setup_tokens() { +static int setup_tokens(void) { HANDLE tok = NULL; TOKEN_PRIVILEGES tp; DWORD err = -1; diff --git a/libr/io/p/io_winedbg.c b/libr/io/p/io_winedbg.c index 30b5803040..a72ddea125 100644 --- a/libr/io/p/io_winedbg.c +++ b/libr/io/p/io_winedbg.c @@ -191,7 +191,7 @@ static void printcmd (RIO *io, const char *cmd) { free (res); } -static struct winedbg_x86_32 regState() { +static struct winedbg_x86_32 regState(void) { struct winedbg_x86_32 r = {0}; char *res = runcmd ("info reg"); if (res) { diff --git a/libr/lang/lang.c b/libr/lang/lang.c index c8a6091bab..d3c533e1c2 100644 --- a/libr/lang/lang.c +++ b/libr/lang/lang.c @@ -24,7 +24,7 @@ R_API void r_lang_plugin_free (RLangPlugin *p) { } } -R_API RLang *r_lang_new() { +R_API RLang *r_lang_new(void) { RLang *lang = R_NEW0 (RLang); if (!lang) { return NULL; diff --git a/libr/main/r2agent.c b/libr/main/r2agent.c index 5369163b90..e84bb28920 100644 --- a/libr/main/r2agent.c +++ b/libr/main/r2agent.c @@ -26,7 +26,7 @@ static int usage (int v) { return !v; } -static int showversion() { +static int showversion(void) { return r_main_version_print ("r2agent"); } diff --git a/libr/main/rahash2.c b/libr/main/rahash2.c index 96de69763b..6c309c89b0 100644 --- a/libr/main/rahash2.c +++ b/libr/main/rahash2.c @@ -295,7 +295,7 @@ static int do_help(int line) { return 0; } -static void algolist() { +static void algolist(void) { ut64 bits; ut64 i; for (i = 0; i < R_HASH_NBITS; i++) { diff --git a/libr/main/rarun2.c b/libr/main/rarun2.c index f4c7e2aaa1..1670048449 100644 --- a/libr/main/rarun2.c +++ b/libr/main/rarun2.c @@ -9,7 +9,7 @@ static void fwd(int sig) { /* do nothing? send kill signal to remote process */ } -static void rarun2_tty() { +static void rarun2_tty(void) { /* TODO: Implement in native code */ r_sys_cmd ("tty"); close (1); diff --git a/libr/main/rasign2.c b/libr/main/rasign2.c index a5a7e1862d..aa46601dcd 100644 --- a/libr/main/rasign2.c +++ b/libr/main/rasign2.c @@ -2,7 +2,7 @@ #include #include -static void rasign_show_help() { +static void rasign_show_help(void) { printf ("Usage: rasign2 [options] [file]\n" " -a [-a] add extra 'a' to analysis command\n" " -o sigs.sdb add signatures to file, create if it does not exist\n" diff --git a/libr/main/rasm2.c b/libr/main/rasm2.c index d52c8418d1..c26c95f196 100644 --- a/libr/main/rasm2.c +++ b/libr/main/rasm2.c @@ -29,7 +29,7 @@ static void __as_set_archbits(RAsmState *as) { r_anal_set_bits (as->anal, sysbits); } -static RAsmState *__as_new() { +static RAsmState *__as_new(void) { RAsmState *as = R_NEW0 (RAsmState); if (as) { as->l = r_lib_new (NULL, NULL); diff --git a/libr/main/rax2.c b/libr/main/rax2.c index 6dbe24cc10..b0ad86a28b 100644 --- a/libr/main/rax2.c +++ b/libr/main/rax2.c @@ -99,11 +99,11 @@ static int format_output(RNum *num, char mode, const char *s, int force_mode, ut return true; } -static void print_ascii_table() { - printf("%s", ret_ascii_table()); +static void print_ascii_table(void) { + printf ("%s", ret_ascii_table()); } -static int help() { +static int help(void) { printf ( " =[base] ; rax2 =10 0x46 -> output in base 10\n" " int -> hex ; rax2 10\n" diff --git a/libr/parse/ctype.c b/libr/parse/ctype.c index 4d96f0d25f..c31e39daa3 100644 --- a/libr/parse/ctype.c +++ b/libr/parse/ctype.c @@ -25,7 +25,7 @@ static const char *lang = "type : ? ( | )*;"; -R_API RParseCType *r_parse_ctype_new() { +R_API RParseCType *r_parse_ctype_new(void) { RParseCType *ctype = R_NEW (RParseCType); if (!ctype) { return NULL; @@ -251,4 +251,4 @@ R_API void r_parse_ctype_type_free(RParseCTypeType *type) { break; } free (type); -} \ No newline at end of file +} diff --git a/libr/reg/profile.c b/libr/reg/profile.c index f72d0965de..8ae3115726 100644 --- a/libr/reg/profile.c +++ b/libr/reg/profile.c @@ -31,7 +31,7 @@ static ut64 parse_size(char *s, char **end) { return strtoul (s, end, 0) << 3; } -//TODO: implement R_API bool r_reg_set_def_string() +//TODO: implement bool r_reg_set_def_string() static const char *parse_def(RReg *reg, char **tok, const int n) { char *end; int type, type2; diff --git a/libr/search/bytepat.c b/libr/search/bytepat.c index d9457aaffb..9d1468308b 100644 --- a/libr/search/bytepat.c +++ b/libr/search/bytepat.c @@ -13,7 +13,7 @@ typedef struct _fnditem { void* next; } fnditem; -static fnditem* init_fi() { +static fnditem* init_fi(void) { fnditem* n; n = (fnditem*) malloc (sizeof (fnditem)); if (!n) { diff --git a/libr/search/old_xrefs.c b/libr/search/old_xrefs.c index ebcc2750e9..2608ef45b1 100644 --- a/libr/search/old_xrefs.c +++ b/libr/search/old_xrefs.c @@ -36,11 +36,11 @@ ~:$ cat example.c #include -void func() { +void func(void) { printf("Hello "); } -int main() { +int main(void) { func(); func(); func(); } diff --git a/libr/socket/r2pipe.c b/libr/socket/r2pipe.c index c27b53d32c..6c1e53dcce 100644 --- a/libr/socket/r2pipe.c +++ b/libr/socket/r2pipe.c @@ -194,7 +194,7 @@ static R2Pipe* r2pipe_open_spawn(R2Pipe* r2pipe) { #endif } -static R2Pipe *r2pipe_new() { +static R2Pipe *r2pipe_new(void) { R2Pipe *r2pipe = R_NEW0 (R2Pipe); if (r2pipe) { #if __UNIX__ diff --git a/libr/socket/run.c b/libr/socket/run.c index 8455b9c093..3c75f2a255 100644 --- a/libr/socket/run.c +++ b/libr/socket/run.c @@ -612,7 +612,7 @@ R_API bool r_run_parseline(RRunProfile *p, const char *b) { return true; } -R_API const char *r_run_help() { +R_API const char *r_run_help(void) { return "program=/bin/ls\n" "arg1=/bin\n" diff --git a/libr/syscall/syscall.c b/libr/syscall/syscall.c index 5b3d05d6e0..aa76c237d4 100644 --- a/libr/syscall/syscall.c +++ b/libr/syscall/syscall.c @@ -1,4 +1,4 @@ -/* radare - Copyright 2008-2018 - LGPL -- pancake */ +/* radare - Copyright 2008-2020 - LGPL -- pancake */ #include #include @@ -17,7 +17,7 @@ R_API RSyscall* r_syscall_ref(RSyscall *sc) { return sc; } -R_API RSyscall* r_syscall_new() { +R_API RSyscall* r_syscall_new(void) { RSyscall *rs = R_NEW0 (RSyscall); if (rs) { rs->sysport = sysport_x86; diff --git a/libr/util/alloc.c b/libr/util/alloc.c index fa63eda38f..00699e974d 100644 --- a/libr/util/alloc.c +++ b/libr/util/alloc.c @@ -1,9 +1,9 @@ -/* radare - LGPL - Copyright 2019 - pancake */ +/* radare - LGPL - Copyright 2019-2020 - pancake */ #include #include -R_API void r_alloc_init () { +R_API void r_alloc_init (void) { #if R_MALLOC_WRAPPER r_alloc_hooks (malloc, calloc, realloc, free); #endif diff --git a/libr/util/ascii_table.c b/libr/util/ascii_table.c index 05b8bdec1c..1be70a4073 100644 --- a/libr/util/ascii_table.c +++ b/libr/util/ascii_table.c @@ -74,6 +74,6 @@ static const char *ascii_table = "077 63 3F ? 177 127 7F DEL\n" ; -R_API const char *ret_ascii_table() { +R_API const char *ret_ascii_table(void) { return ascii_table; } diff --git a/libr/util/cache.c b/libr/util/cache.c index e0816d06f3..a85d4f1f91 100644 --- a/libr/util/cache.c +++ b/libr/util/cache.c @@ -1,11 +1,11 @@ -/* radare - LGPL - Copyright 2013-2018 - pancake */ +/* radare - LGPL - Copyright 2013-2020 - pancake */ // XXX: should use the same code as libr/io/cache.c // one malloc per write #include // TODO: optimize reallocs.. store RBuffer info.. wait. extend r_buf_ for that? -R_API RCache *r_cache_new() { +R_API RCache *r_cache_new(void) { RCache *c = R_NEW0 (RCache); if (!c) { return NULL; diff --git a/libr/util/file.c b/libr/util/file.c index 5e425e25d2..4f26d29ea9 100644 --- a/libr/util/file.c +++ b/libr/util/file.c @@ -1108,7 +1108,7 @@ err_r_file_mkstemp: return h; } -R_API char *r_file_tmpdir() { +R_API char *r_file_tmpdir(void) { #if __WINDOWS__ LPTSTR tmpdir; char *path = NULL; diff --git a/libr/util/graph.c b/libr/util/graph.c index 714632acc2..57d477ce2e 100644 --- a/libr/util/graph.c +++ b/libr/util/graph.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2007-2019 - pancake, ret2libc */ +/* radare - LGPL - Copyright 2007-2020 - pancake, ret2libc */ #include @@ -103,7 +103,7 @@ static void dfs_node (RGraph *g, RGraphNode *n, RGraphVisitor *vis, int color[], r_stack_free (s); } -R_API RGraph *r_graph_new() { +R_API RGraph *r_graph_new(void) { RGraph *t = R_NEW0 (RGraph); if (!t) { return NULL; diff --git a/libr/util/list.c b/libr/util/list.c index 30533fd808..31796439f6 100644 --- a/libr/util/list.c +++ b/libr/util/list.c @@ -6,7 +6,7 @@ #define _R_LIST_C_ #include "r_util.h" -inline RListIter *r_list_iter_new() { +inline RListIter *r_list_iter_new(void) { return calloc (1, sizeof (RListIter)); } @@ -165,7 +165,7 @@ R_API int r_list_join(RList *list1, RList *list2) { return 1; } -R_API RList *r_list_new() { +R_API RList *r_list_new(void) { RList *list = R_NEW0 (RList); if (!list) { return NULL; @@ -363,13 +363,12 @@ R_API void r_list_reverse(RList *list) { } R_API RList *r_list_clone(const RList *list) { - RList *l = NULL; RListIter *iter; void *data; r_return_val_if_fail (list, NULL); - l = r_list_new (); + RList *l = r_list_new (); if (!l) { return NULL; } diff --git a/libr/util/pj.c b/libr/util/pj.c index ec738a3c56..459f2862df 100644 --- a/libr/util/pj.c +++ b/libr/util/pj.c @@ -21,7 +21,7 @@ static void pj_comma(PJ *j) { j->is_key = false; } -R_API PJ *pj_new() { +R_API PJ *pj_new(void) { PJ *j = R_NEW0 (PJ); if (j) { r_strbuf_init (&j->sb); diff --git a/libr/util/print.c b/libr/util/print.c index edcd4db2c6..4d74895e42 100644 --- a/libr/util/print.c +++ b/libr/util/print.c @@ -297,7 +297,7 @@ R_API void r_print_stereogram_print(RPrint *p, const char *ret) { } } -R_API RPrint* r_print_new() { +R_API RPrint* r_print_new(void) { RPrint *p = R_NEW0 (RPrint); if (!p) { return NULL; diff --git a/libr/util/range.c b/libr/util/range.c index f32938b8d7..07ea5886f2 100644 --- a/libr/util/range.c +++ b/libr/util/range.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2008-2010 pancake */ +/* radare - LGPL - Copyright 2008-2020 pancake */ #include @@ -8,7 +8,7 @@ //void (*ranges_new_callback)(struct range_t *r) = NULL; -R_API RRange *r_range_new() { +R_API RRange *r_range_new(void) { RRange *r = R_NEW0 (RRange); if (r) { r->count = r->changed = 0; diff --git a/libr/util/rbtree.c b/libr/util/rbtree.c index d5532c7011..2540af22a6 100644 --- a/libr/util/rbtree.c +++ b/libr/util/rbtree.c @@ -379,7 +379,7 @@ R_API void r_rbtree_iter_prev(RBIter *it) { _next (it, 1); } -R_API RContRBTree *r_rbtree_cont_new() { +R_API RContRBTree *r_rbtree_cont_new(void) { return R_NEW0 (RContRBTree); } diff --git a/libr/util/regex/test.c b/libr/util/regex/test.c index 96b6c995c1..8785e441ef 100644 --- a/libr/util/regex/test.c +++ b/libr/util/regex/test.c @@ -1,7 +1,7 @@ #include #include -int _main() { +int _main(void) { RRegex rx; int rc = r_regex_comp (&rx, "^hi", R_REGEX_NOSUB); if (rc) { @@ -18,7 +18,7 @@ int _main() { return 0; } -static void test_or() { +static void test_or(void) { RRegex *rx = r_regex_new ("(eax|ebx)", "e"); printf ("result (%s) = %d\n", "mov eax", r_regex_match("(eax|ebx)", "e", "mov eax")); printf ("result (%s) = %d\n", "mov ebx", r_regex_match("(eax|ebx)", "e", "mov ebx")); diff --git a/libr/util/sandbox.c b/libr/util/sandbox.c index ef7973eacd..49907ed5cb 100644 --- a/libr/util/sandbox.c +++ b/libr/util/sandbox.c @@ -219,8 +219,10 @@ R_API int r_sandbox_system(const char *x, int n) { eprintf ("Error parsing command arguments\n"); return -1; } - int child = fork(); - if (child == -1) return -1; + int child = fork (); + if (child == -1) { + return -1; + } if (child) { return waitpid (child, NULL, 0); } @@ -423,7 +425,7 @@ R_API DIR* r_sandbox_opendir (const char *path) { return opendir (path); } #endif -R_API bool r_sys_stop () { +R_API bool r_sys_stop (void) { if (enabled) { return false; } diff --git a/libr/util/sys.c b/libr/util/sys.c index e259d40927..f35dd34e0f 100644 --- a/libr/util/sys.c +++ b/libr/util/sys.c @@ -131,7 +131,7 @@ static const struct {const char* name; ut64 bit;} arch_bit_array[] = { {NULL, 0} }; -R_API int r_sys_fork() { +R_API int r_sys_fork(void) { #if HAVE_FORK #if __WINDOWS__ return -1; @@ -1189,7 +1189,7 @@ R_API char *r_sys_pid_to_path(int pid) { } // TODO: rename to r_sys_env_init() -R_API char **r_sys_get_environ () { +R_API char **r_sys_get_environ (void) { #if __APPLE__ && !HAVE_ENVIRON env = *_NSGetEnviron(); #else @@ -1217,7 +1217,7 @@ R_API char *r_sys_whoami (char *buf) { return hasbuf? buf: strdup (buf); } -R_API int r_sys_getpid() { +R_API int r_sys_getpid(void) { #if __UNIX__ return getpid (); #elif __WINDOWS__ diff --git a/libr/util/table.c b/libr/util/table.c index 49efb005a6..35c2e70ff0 100644 --- a/libr/util/table.c +++ b/libr/util/table.c @@ -74,7 +74,7 @@ R_API RTableColumn *r_table_column_clone(RTableColumn *col) { return c; } -R_API RTable *r_table_new() { +R_API RTable *r_table_new(void) { RTable *t = R_NEW0 (RTable); if (t) { t->showHeader = true; diff --git a/libr/util/thread_cond.c b/libr/util/thread_cond.c index ed67eae1a2..209fc5e0fe 100644 --- a/libr/util/thread_cond.c +++ b/libr/util/thread_cond.c @@ -1,8 +1,8 @@ -/* radare - LGPL - Copyright 2009-2018 - thestr4ng3r */ +/* radare - LGPL - Copyright 2009-2020 - thestr4ng3r */ #include -R_API RThreadCond *r_th_cond_new() { +R_API RThreadCond *r_th_cond_new(void) { RThreadCond *cond = R_NEW0 (RThreadCond); if (!cond) { return NULL; diff --git a/libr/util/udiff.c b/libr/util/udiff.c index aea4cd2412..92483a354c 100644 --- a/libr/util/udiff.c +++ b/libr/util/udiff.c @@ -18,7 +18,7 @@ R_API RDiff *r_diff_new_from(ut64 off_a, ut64 off_b) { return d; } -R_API RDiff *r_diff_new() { +R_API RDiff *r_diff_new(void) { return r_diff_new_from (0, 0); } @@ -96,7 +96,7 @@ R_API char *r_diff_buffers_to_string(RDiff *d, const ut8 *a, int la, const ut8 * } #endif -#define diffHit() {\ +#define diffHit(void) {\ const size_t i_hit = i - hit;\ int ra = la - i_hit;\ int rb = lb - i_hit;\ diff --git a/libr/util/unum.c b/libr/util/unum.c index a17e54e590..55e090f225 100644 --- a/libr/util/unum.c +++ b/libr/util/unum.c @@ -29,7 +29,7 @@ static int r_rand(int mod) { #endif } -R_API void r_num_irand() { +R_API void r_num_irand(void) { r_srand (r_sys_now ()); } diff --git a/libr/util/w32-sys.c b/libr/util/w32-sys.c index 59e5e53a16..842b9cbefc 100644 --- a/libr/util/w32-sys.c +++ b/libr/util/w32-sys.c @@ -12,7 +12,7 @@ void r_sys_perror_str(const char *fun); #define ErrorExit(x) { r_sys_perror(x); return false; } char *ReadFromPipe(HANDLE fh, int *outlen); -R_API char *r_sys_get_src_dir_w32() { +R_API char *r_sys_get_src_dir_w32(void) { TCHAR fullpath[MAX_PATH + 1]; TCHAR shortpath[MAX_PATH + 1]; diff --git a/shlr/java/class.c b/shlr/java/class.c index 94fac8cd46..0b025569b2 100644 --- a/shlr/java/class.c +++ b/shlr/java/class.c @@ -73,7 +73,7 @@ R_API void r_bin_java_fmtype_free(void /*RBinJavaField*/ *fm_type); R_API RBinJavaAttrInfo *r_bin_java_read_next_attr(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len); R_API RBinJavaCPTypeObj *r_bin_java_read_next_constant_pool_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len); R_API RBinJavaAttrMetas *r_bin_java_get_attr_type_by_name(const char *name); -R_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(); +R_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(void); R_API ut64 r_bin_java_read_class_file2(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len); R_API RBinJavaAttrInfo *r_bin_java_get_attr_from_field(RBinJavaField *field, R_BIN_JAVA_ATTR_TYPE attr_type, ut32 pos); R_API RBinJavaField *r_bin_java_read_next_field(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len); @@ -249,7 +249,7 @@ R_API ut64 r_bin_java_do_nothing_calc_size(RBinJavaCPTypeObj *obj); R_API ut64 r_bin_java_methodhandle_cp_calc_size(RBinJavaCPTypeObj *obj); R_API ut64 r_bin_java_methodtype_cp_calc_size(RBinJavaCPTypeObj *obj); R_API ut64 r_bin_java_invokedynamic_cp_calc_size(RBinJavaCPTypeObj *obj); -R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(); +R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void); R_API RList *r_bin_java_find_cp_const_by_val_float(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len); R_API RList *r_bin_java_find_cp_const_by_val_double(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len); @@ -1253,7 +1253,7 @@ R_API bool sdb_iterate_build_list(void *user, const char *k, const char *v) { return true; } -R_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp() { +R_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(void) { if (R_BIN_JAVA_NULL_TYPE_INITTED) { return &R_BIN_JAVA_NULL_TYPE; } @@ -2509,7 +2509,7 @@ R_API ut64 r_bin_java_get_method_code_offset(RBinJavaField *fm_type) { return offset; } -R_API RBinField *r_bin_java_allocate_rbinfield() { +R_API RBinField *r_bin_java_allocate_rbinfield(void) { RBinField *t = (RBinField *) malloc (sizeof (RBinField)); if (t) { memset (t, 0, sizeof (RBinField)); @@ -4476,7 +4476,7 @@ R_API ut16 r_bin_java_find_cp_class_ref_from_name_idx(RBinJavaObj *bin, ut16 nam return (pos != len) ? pos : 0; } -R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame() { +R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void) { RBinJavaStackMapFrame *sf = R_NEW0 (RBinJavaStackMapFrame); if (!sf) { return NULL; @@ -8281,15 +8281,15 @@ R_API ut16 r_bin_java_calculate_method_access_value(const char *access_flags_str return calculate_access_value (access_flags_str, METHOD_ACCESS_FLAGS); } -R_API RList *retrieve_all_method_access_string_and_value() { +R_API RList *retrieve_all_method_access_string_and_value(void) { return retrieve_all_access_string_and_value (METHOD_ACCESS_FLAGS); } -R_API RList *retrieve_all_field_access_string_and_value() { +R_API RList *retrieve_all_field_access_string_and_value(void) { return retrieve_all_access_string_and_value (FIELD_ACCESS_FLAGS); } -R_API RList *retrieve_all_class_access_string_and_value() { +R_API RList *retrieve_all_class_access_string_and_value(void) { return retrieve_all_access_string_and_value (CLASS_ACCESS_FLAGS); } @@ -9086,7 +9086,7 @@ R_API ut8 *U(r_bin_java_cp_get_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 return r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_FIELDREF, class_idx, name_and_type_idx); } -R_API void U(deinit_java_type_null)() { +R_API void U(deinit_java_type_null)(void) { free (R_BIN_JAVA_NULL_TYPE.metas); } diff --git a/shlr/java/code.c b/shlr/java/code.c index 542ad00d85..a48ec008fc 100644 --- a/shlr/java/code.c +++ b/shlr/java/code.c @@ -22,11 +22,11 @@ #define R_API #endif -static void init_switch_op (); -static int enter_switch_op (ut64 addr, const ut8 * bytes, int len); -static int update_switch_op (ut64 addr, const ut8 * bytes); -static int update_bytes_consumed (int sz); -static int handle_switch_op (ut64 addr, const ut8 * bytes, char *output, int outlen); +static void init_switch_op(void); +static int enter_switch_op(ut64 addr, const ut8 * bytes, int len); +static int update_switch_op(ut64 addr, const ut8 * bytes); +static int update_bytes_consumed(int sz); +static int handle_switch_op(ut64 addr, const ut8 * bytes, char *output, int outlen); static ut8 IN_SWITCH_OP = 0; typedef struct current_table_switch_t { @@ -41,7 +41,7 @@ static CurrentTableSwitch SWITCH_OP; static ut64 BYTES_CONSUMED = 0LL; //static RBinJavaObj *BIN_OBJ = NULL; -static void init_switch_op () { +static void init_switch_op (void) { memset (&SWITCH_OP, 0, sizeof (SWITCH_OP)); } @@ -256,7 +256,7 @@ R_API int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *byt return update_bytes_consumed (JAVA_OPS[idx].size); } -R_API void r_java_new_method () { +R_API void r_java_new_method (void) { IFDBG eprintf ("Reseting the bytes consumed, they were: 0x%04"PFMT64x".\n", BYTES_CONSUMED); init_switch_op (); IN_SWITCH_OP = 0; diff --git a/shlr/tcc/tcc.h b/shlr/tcc/tcc.h index e9ec6e2aa3..71492083ed 100644 --- a/shlr/tcc/tcc.h +++ b/shlr/tcc/tcc.h @@ -852,7 +852,7 @@ ST_DATA int tcc_ext; /* XXX: get rid of this ASAP */ ST_DATA struct TCCState *tcc_state; -static inline int tcc_nerr() { +static inline int tcc_nerr(void) { return tcc_state->nb_errors; } diff --git a/test/db/tools/r2 b/test/db/tools/r2 index 9d8a8a2f72..7f043af7c9 100644 --- a/test/db/tools/r2 +++ b/test/db/tools/r2 @@ -10,6 +10,17 @@ EXPECT_ERR=< #include -static int usage () { +static int usage (void) { eprintf ("./test [-a x86|arm] [-b 32|64] hi.r\n"); return 1; } diff --git a/test/unit/test_anal_types.c b/test/unit/test_anal_types.c index fb25ef1cb6..95bf46299e 100644 --- a/test/unit/test_anal_types.c +++ b/test/unit/test_anal_types.c @@ -42,7 +42,7 @@ static void setup_sdb_for_not_found(Sdb *res) { sdb_set (res, "struct.omega.ff", "", 0); } -static bool test_anal_get_base_type_struct() { +static bool test_anal_get_base_type_struct(void) { RAnal *anal = r_anal_new (); mu_assert_notnull (anal, "Couldn't create new RAnal"); mu_assert_notnull (anal->sdb_types, "Couldn't create new RAnal.sdb_types"); @@ -72,7 +72,7 @@ static bool test_anal_get_base_type_struct() { mu_end; } -static bool test_anal_get_base_type_union() { +static bool test_anal_get_base_type_union(void) { RAnal *anal = r_anal_new (); mu_assert_notnull (anal, "Couldn't create new RAnal"); mu_assert_notnull (anal->sdb_types, "Couldn't create new RAnal.sdb_types"); @@ -100,7 +100,7 @@ static bool test_anal_get_base_type_union() { mu_end; } -static bool test_anal_get_base_type_enum() { +static bool test_anal_get_base_type_enum(void) { RAnal *anal = r_anal_new (); mu_assert_notnull (anal, "Couldn't create new RAnal"); mu_assert_notnull (anal->sdb_types, "Couldn't create new RAnal.sdb_types"); @@ -128,7 +128,7 @@ static bool test_anal_get_base_type_enum() { mu_end; } -static bool test_anal_get_base_type_not_found() { +static bool test_anal_get_base_type_not_found(void) { RAnal *anal = r_anal_new (); setup_sdb_for_not_found(anal->sdb_types); @@ -151,7 +151,7 @@ static bool test_anal_get_base_type_not_found() { mu_end; } -int all_tests() { +int all_tests(void) { mu_run_test (test_anal_get_base_type_struct); mu_run_test (test_anal_get_base_type_union); mu_run_test (test_anal_get_base_type_enum); diff --git a/test/unit/test_annotated_code.c b/test/unit/test_annotated_code.c index b6f1f24701..11bd12acb3 100644 --- a/test/unit/test_annotated_code.c +++ b/test/unit/test_annotated_code.c @@ -21,7 +21,7 @@ static RCodeAnnotation make_code_annotation(int st, int en, RCodeAnnotationType return annotation; } -static RVector *get_some_code_annotation_for_add() { +static RVector *get_some_code_annotation_for_add(void) { RVector *test_annotations = r_vector_new (sizeof (RCodeAnnotation), NULL, NULL); RCodeAnnotation annotation; r_vector_init (test_annotations, sizeof (RCodeAnnotation), NULL, NULL); @@ -32,7 +32,7 @@ static RVector *get_some_code_annotation_for_add() { return test_annotations; } -static RVector *get_some_annotations_for_in() { +static RVector *get_some_annotations_for_in(void) { RVector *test_annotations = r_vector_new (sizeof (RCodeAnnotation), NULL, NULL); RCodeAnnotation annotation; annotation = make_code_annotation (1, 2, R_CODE_ANNOTATION_TYPE_OFFSET, 123, R_SYNTAX_HIGHLIGHT_TYPE_KEYWORD); @@ -55,7 +55,7 @@ static RVector *get_some_annotations_for_in() { return test_annotations; } -static RVector *get_annotations_for_hello_world() { +static RVector *get_annotations_for_hello_world(void) { RVector *test_annotations = r_vector_new (sizeof (RCodeAnnotation), NULL, NULL); RCodeAnnotation annotation; // r_vector_init (&test_annotations, sizeof (RCodeAnnotation), NULL, NULL); @@ -82,7 +82,7 @@ static RVector *get_annotations_for_hello_world() { return test_annotations; } -static RAnnotatedCode *get_hello_world() { +static RAnnotatedCode *get_hello_world(void) { char *test_string = strdup ("\nvoid main(void)\n{\n sym.imp.puts(\"Hello, World!\");\n return;\n}\n"); RAnnotatedCode *code = r_annotated_code_new (test_string); @@ -97,7 +97,7 @@ static RAnnotatedCode *get_hello_world() { return code; } -static bool test_r_annotated_code_new() { +static bool test_r_annotated_code_new(void) { //Testing RAnnoatedCode->code char *test_string = strdup ("How are you?"); RAnnotatedCode *code = r_annotated_code_new (test_string); @@ -110,7 +110,7 @@ static bool test_r_annotated_code_new() { mu_end; } -static bool test_r_annotated_code_free() { +static bool test_r_annotated_code_free(void) { char *test_string = strdup ("How are you?"); RAnnotatedCode *code = r_annotated_code_new (test_string); @@ -141,7 +141,7 @@ static bool test_equal(RCodeAnnotation *first, RCodeAnnotation *second) { // Fir return false; } -static bool test_r_annotated_code_add_annotation() { +static bool test_r_annotated_code_add_annotation(void) { char *test_string = strdup ("abcdefghijklmnopqrtstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"); RAnnotatedCode *code = r_annotated_code_new (test_string); RVector /**/ *test_annotations; @@ -164,7 +164,7 @@ static bool test_r_annotated_code_add_annotation() { mu_end; } -static bool test_r_annotated_code_annotations_in() { +static bool test_r_annotated_code_annotations_in(void) { char *test_string = strdup ("abcdefghijklmnopqrtstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"); RAnnotatedCode *code = r_annotated_code_new (test_string); RVector /**/ *test_annotations; @@ -194,7 +194,7 @@ static bool test_r_annotated_code_annotations_in() { mu_end; } -static bool test_r_annotated_code_annotations_range() { +static bool test_r_annotated_code_annotations_range(void) { char *test_string = strdup ("abcdefghijklmnopqrtstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"); RAnnotatedCode *code = r_annotated_code_new (test_string); RVector /**/ *test_annotations; @@ -226,7 +226,7 @@ static bool test_r_annotated_code_annotations_range() { mu_end; } -static bool test_r_annotated_code_line_offsets() { +static bool test_r_annotated_code_line_offsets(void) { RAnnotatedCode *code = get_hello_world (); RVector *offsets = r_annotated_code_line_offsets (code); @@ -250,7 +250,7 @@ static bool test_r_annotated_code_line_offsets() { mu_end; } -static bool test_r_core_annotated_code_print_json() { +static bool test_r_core_annotated_code_print_json(void) { RAnnotatedCode *code = get_hello_world (); char *actual; char *expected = "{\"code\":\"\\nvoid main(void)\\n{\\n sym.imp.puts(\\\"Hello, World!\\\");\\n return;\\n}\\n\",\"annotations\":[{\"start\":1,\"end\":5,\"type\":\"syntax_highlight\",\"syntax_highlight\":\"datatype\"},{\"start\":6,\"end\":10,\"type\":\"syntax_highlight\",\"syntax_highlight\":\"function_name\"},{\"start\":11,\"end\":15,\"type\":\"syntax_highlight\",\"syntax_highlight\":\"keyword\"},{\"start\":23,\"end\":35,\"type\":\"syntax_highlight\",\"syntax_highlight\":\"function_name\"},{\"start\":36,\"end\":51,\"type\":\"syntax_highlight\",\"syntax_highlight\":\"constant_variable\"},{\"start\":23,\"end\":52,\"type\":\"offset\",\"offset\":4440},{\"start\":58,\"end\":64,\"type\":\"offset\",\"offset\":4447},{\"start\":58,\"end\":64,\"type\":\"syntax_highlight\",\"syntax_highlight\":\"keyword\"},{\"start\":58,\"end\":64,\"type\":\"offset\",\"offset\":4447}]}\n"; @@ -267,7 +267,7 @@ static bool test_r_core_annotated_code_print_json() { mu_end; } -static bool test_r_core_annotated_code_print() { +static bool test_r_core_annotated_code_print(void) { RAnnotatedCode *code = get_hello_world (); char *actual; //Checking without line offset @@ -307,7 +307,7 @@ static bool test_r_core_annotated_code_print() { mu_end; } -static bool test_r_core_annotated_code_print_comment_cmds() { +static bool test_r_core_annotated_code_print_comment_cmds(void) { RAnnotatedCode *code = get_hello_world (); char *actual; char *expected = "CCu base64:c3ltLmltcC5wdXRzKCJIZWxsbywgV29ybGQhIik= @ 0x1158\n" @@ -325,7 +325,7 @@ static bool test_r_core_annotated_code_print_comment_cmds() { mu_end; } -static int all_tests() { +static int all_tests(void) { mu_run_test (test_r_annotated_code_new); mu_run_test (test_r_annotated_code_free); mu_run_test (test_r_annotated_code_add_annotation); diff --git a/test/unit/test_vector.c b/test/unit/test_vector.c index 0a6ca182e8..a7788ede1a 100644 --- a/test/unit/test_vector.c +++ b/test/unit/test_vector.c @@ -61,7 +61,7 @@ static bool _init_test_pvector2(RPVector *v, size_t len, size_t padding) { mu_assert ("init_test_pvector2", _r); \ } -static bool test_vector_fini() { +static bool test_vector_fini(void) { RVector v; r_vector_init (&v, sizeof (void *), NULL, free); r_vector_push (&v, &v); @@ -89,7 +89,7 @@ static bool test_vector_fini() { } -static bool test_vector_init() { +static bool test_vector_init(void) { RVector v; r_vector_init (&v, 42, (void *)1337, (void *)42); mu_assert_eq (v.elem_size, 42UL, "init elem_size"); @@ -101,7 +101,7 @@ static bool test_vector_init() { mu_end; } -static bool test_vector_new() { +static bool test_vector_new(void) { RVector *v = r_vector_new (42, (void *)1337, (void *)42); mu_assert ("new", v); mu_assert_eq (v->elem_size, 42UL, "new elem_size"); @@ -125,7 +125,7 @@ static void elem_free_test(void *e, void *user) { acc[e_val]++; } -static bool test_vector_clear() { +static bool test_vector_clear(void) { RVector v; int acc[FREE_TEST_COUNT+1] = {0}; init_test_vector (&v, FREE_TEST_COUNT, 0, elem_free_test, acc); @@ -142,7 +142,7 @@ static bool test_vector_clear() { mu_end; } -static bool test_vector_free() { +static bool test_vector_free(void) { RVector *v = r_vector_new (4, NULL, NULL); int acc[FREE_TEST_COUNT+1] = {0}; init_test_vector (v, FREE_TEST_COUNT, 0, elem_free_test, acc); @@ -163,7 +163,7 @@ static bool test_vector_free() { } -static bool test_vector_clone() { +static bool test_vector_clone(void) { RVector v; init_test_vector (&v, 5, 0, NULL, NULL); RVector *v1 = r_vector_clone (&v); @@ -196,7 +196,7 @@ static bool test_vector_clone() { mu_end; } -static bool test_vector_empty() { +static bool test_vector_empty(void) { RVector v; r_vector_init (&v, 1, NULL, NULL); bool empty = r_vector_empty (&v); @@ -218,7 +218,7 @@ static bool test_vector_empty() { mu_end; } -static bool test_vector_remove_at() { +static bool test_vector_remove_at(void) { RVector v; init_test_vector (&v, 5, 0, NULL, NULL); @@ -245,7 +245,7 @@ static bool test_vector_remove_at() { mu_end; } -static bool test_vector_insert() { +static bool test_vector_insert(void) { RVector v; init_test_vector (&v, 4, 2, NULL, NULL); @@ -312,7 +312,7 @@ static bool test_vector_insert() { mu_end; } -static bool test_vector_insert_range() { +static bool test_vector_insert_range(void) { RVector v; ut32 range[] = { 0xC0, 0xFF, 0xEE }; @@ -379,7 +379,7 @@ static bool test_vector_insert_range() { mu_end; } -static bool test_vector_pop() { +static bool test_vector_pop(void) { RVector v; init_test_vector (&v, 3, 0, NULL, NULL); @@ -404,7 +404,7 @@ static bool test_vector_pop() { mu_end; } -static bool test_vector_pop_front() { +static bool test_vector_pop_front(void) { RVector v; init_test_vector (&v, 3, 0, NULL, NULL); @@ -429,7 +429,7 @@ static bool test_vector_pop_front() { mu_end; } -static bool test_vector_push() { +static bool test_vector_push(void) { RVector v; r_vector_init (&v, 4, NULL, NULL); @@ -494,7 +494,7 @@ static bool test_vector_push() { mu_end; } -static bool test_vector_push_front() { +static bool test_vector_push_front(void) { RVector v; r_vector_init (&v, 4, NULL, NULL); @@ -558,7 +558,7 @@ static bool test_vector_push_front() { mu_end; } -static bool test_vector_reserve() { +static bool test_vector_reserve(void) { RVector v; r_vector_init (&v, 4, NULL, NULL); @@ -583,7 +583,7 @@ static bool test_vector_reserve() { mu_end; } -static bool test_vector_shrink() { +static bool test_vector_shrink(void) { RVector v; init_test_vector (&v, 5, 5, NULL, NULL); void *a = r_vector_shrink (&v); @@ -602,7 +602,7 @@ static bool test_vector_shrink() { mu_end; } -static bool test_vector_foreach() { +static bool test_vector_foreach(void) { RVector v; init_test_vector (&v, 5, 5, NULL, NULL); @@ -623,7 +623,7 @@ static bool test_vector_foreach() { mu_end; } -static bool test_vector_lower_bound() { +static bool test_vector_lower_bound(void) { RVector v; r_vector_init (&v, sizeof (st64), NULL, NULL); st64 a[] = {0, 2, 4, 6, 8}; @@ -646,7 +646,7 @@ static bool test_vector_lower_bound() { mu_end; } -static bool test_pvector_init() { +static bool test_pvector_init(void) { RPVector v; r_pvector_init (&v, (void *)1337); mu_assert_eq (v.v.elem_size, sizeof (void *), "elem_size"); @@ -657,7 +657,7 @@ static bool test_pvector_init() { mu_end; } -static bool test_pvector_new() { +static bool test_pvector_new(void) { RPVector *v = r_pvector_new ((void *)1337); mu_assert_eq (v->v.elem_size, sizeof (void *), "elem_size"); mu_assert_eq (v->v.len, 0UL, "len"); @@ -668,7 +668,7 @@ static bool test_pvector_new() { mu_end; } -static bool test_pvector_clear() { +static bool test_pvector_clear(void) { // run with asan or valgrind RPVector v; init_test_pvector (&v, 5, 5); @@ -682,7 +682,7 @@ static bool test_pvector_clear() { mu_end; } -static bool test_pvector_free() { +static bool test_pvector_free(void) { // run with asan or valgrind RPVector *v = R_NEW (RPVector); init_test_pvector (v, 5, 5); @@ -693,7 +693,7 @@ static bool test_pvector_free() { mu_end; } -static bool test_pvector_at() { +static bool test_pvector_at(void) { RPVector v; init_test_pvector (&v, 5, 0); ut32 i; @@ -705,7 +705,7 @@ static bool test_pvector_at() { mu_end; } -static bool test_pvector_set() { +static bool test_pvector_set(void) { RPVector v; init_test_pvector (&v, 5, 0); free (((void **)v.v.a)[3]); @@ -717,7 +717,7 @@ static bool test_pvector_set() { mu_end; } -static bool test_pvector_contains() { +static bool test_pvector_contains(void) { RPVector v; init_test_pvector (&v, 5, 0); void *e = ((void **)v.v.a)[3]; @@ -729,7 +729,7 @@ static bool test_pvector_contains() { mu_end; } -static bool test_pvector_remove_at() { +static bool test_pvector_remove_at(void) { RPVector v; init_test_pvector (&v, 5, 0); ut32 *e = r_pvector_remove_at (&v, 3); @@ -744,7 +744,7 @@ static bool test_pvector_remove_at() { mu_end; } -static bool test_pvector_insert() { +static bool test_pvector_insert(void) { RPVector v; init_test_pvector2 (&v, 4, 2); @@ -800,7 +800,7 @@ static bool test_pvector_insert() { mu_end; } -static bool test_pvector_insert_range() { +static bool test_pvector_insert_range(void) { RPVector v; void *range[] = { (void *)0xC0, (void *)0xFF, (void *)0xEE }; @@ -852,7 +852,7 @@ static bool test_pvector_insert_range() { mu_end; } -static bool test_pvector_pop() { +static bool test_pvector_pop(void) { RPVector v; init_test_pvector2 (&v, 3, 0); @@ -876,7 +876,7 @@ static bool test_pvector_pop() { mu_end; } -static bool test_pvector_pop_front() { +static bool test_pvector_pop_front(void) { RPVector v; init_test_pvector2 (&v, 3, 0); @@ -900,7 +900,7 @@ static bool test_pvector_pop_front() { mu_end; } -static bool test_pvector_push() { +static bool test_pvector_push(void) { RPVector v; r_pvector_init (&v, NULL); @@ -954,7 +954,7 @@ static bool test_pvector_push() { mu_end; } -static bool test_pvector_push_front() { +static bool test_pvector_push_front(void) { RPVector v; r_pvector_init (&v, NULL); @@ -1008,7 +1008,7 @@ static bool test_pvector_push_front() { mu_end; } -static bool test_pvector_sort() { +static bool test_pvector_sort(void) { RPVector v; r_pvector_init (&v, free); r_pvector_push (&v, strdup ("Charmander")); @@ -1029,7 +1029,7 @@ static bool test_pvector_sort() { mu_end; } -static bool test_pvector_foreach() { +static bool test_pvector_foreach(void) { RPVector v; init_test_pvector2 (&v, 5, 5); @@ -1052,7 +1052,7 @@ static bool test_pvector_foreach() { mu_end; } -static bool test_pvector_lower_bound() { +static bool test_pvector_lower_bound(void) { void *a[] = {(void*)0, (void*)2, (void*)4, (void*)6, (void*)8}; RPVector s; r_pvector_init (&s, NULL); @@ -1078,7 +1078,7 @@ static bool test_pvector_lower_bound() { mu_end; } -static int all_tests() { +static int all_tests(void) { mu_run_test (test_vector_init); mu_run_test (test_vector_new); mu_run_test (test_vector_fini);