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
This commit is contained in:
pancake 2020-06-14 16:08:32 +02:00 committed by GitHub
parent 84ecf9fff2
commit 160fc95e66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 325 additions and 320 deletions

View file

@ -165,12 +165,12 @@ a = (b << 3) * 5;
The structure of the C files in r2 must be like this:
```c
/* Copyright ... */ ## copyright
#include <r_core.h> ## 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 <r_core.h> ## 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
```

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2014-2016 - pancake */
/* radare - LGPL - Copyright 2014-2020 - pancake */
#include <r_core.h>
@ -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);

View file

@ -236,7 +236,7 @@ error:
goto beach;
}
static ut64 now_us() {
static ut64 now_us(void) {
LARGE_INTEGER f;
if (!QueryPerformanceFrequency (&f)) {
return 0;

View file

@ -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);
}

View file

@ -1,10 +1,10 @@
/* radare - LGPL - Copyright 2014 - 2015 - condret */
/* radare - LGPL - Copyright 2014-2020 - condret */
#include <r_anal.h>
#include <r_list.h>
#include <r_types.h>
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 ())) {

View file

@ -1,10 +1,10 @@
/* radare - LGPL - Copyright 2010-2017 - nibble, pancake */
/* radare - LGPL - Copyright 2010-2020 - nibble, pancake */
#include <r_anal.h>
#include <r_util.h>
#include <r_diff.h>
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;

View file

@ -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);

View file

@ -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

View file

@ -1,16 +1,16 @@
/* radare - LGPL - Copyright 2010-2019 - pancake, nibble */
/* radare - LGPL - Copyright 2010-2020 - pancake, nibble */
#include <r_anal.h>
#include <r_util.h>
#include <r_list.h>
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;

View file

@ -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

View file

@ -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;

View file

@ -2,7 +2,7 @@
#include <r_anal.h>
static RAnalSwitchOp *__switch_op_new() {
static RAnalSwitchOp *__switch_op_new(void) {
RAnalSwitchOp * swop = R_NEW0 (RAnalSwitchOp);
if (swop) {
swop->cases = r_list_new ();

View file

@ -1,8 +1,8 @@
/* radare - LGPL - Copyright 2010-2011 - pancake<nopcode.org> */
/* radare - LGPL - Copyright 2010-2020 - pancake */
#include <r_anal.h>
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);
}

View file

@ -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);
}

View file

@ -1,8 +1,8 @@
/* radare - LGPL - Copyright 2018-2019 - pancake */
/* radare - LGPL - Copyright 2018-2020 - pancake */
#include <r_asm.h>
R_API RAsmOp *r_asm_op_new() {
R_API RAsmOp *r_asm_op_new(void) {
return R_NEW0 (RAsmOp);
}

View file

@ -41,7 +41,7 @@ extern xtensa_isa xtensa_default_isa;
#endif
#if 1
static void nothing() {
static void nothing(void) {
return;
}

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);
}

View file

@ -5,7 +5,7 @@
#include <getopt.h>
///////////////////////////////////////////////////////////////////////////////
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");

View file

@ -1,21 +1,16 @@
/* radare - LGPL - Copyright 2014-2017 - inisider */
/* radare - LGPL - Copyright 2014-2020 - inisider */
#include <string.h>
#include <r_util.h>
#include <r_core.h>
#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) {

View file

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2009-2018 - pancake */
/* radare2 - LGPL - Copyright 2009-2020 - pancake */
#include <r_bp.h>
#include <config.h>
@ -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);

View file

@ -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;

View file

@ -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) {
}

View file

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2008-2016 - pancake */
/* radare2 - LGPL - Copyright 2008-2020 - pancake */
#include <r_cons.h>
@ -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++) {

View file

@ -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)) {

View file

@ -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 <r_cons.h>
@ -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

View file

@ -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 <r_cons.h>
@ -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 ();

View file

@ -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) {

View file

@ -1,7 +1,6 @@
/* radare - LGPL - Copyright 2009-2020 - pancake, nibble */
#include <r_cons.h>
#include <r_util.h>
#include <r_util/r_print.h>
#include <sdb.h>
@ -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;

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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__

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2019 - pancake */
/* radare - LGPL - Copyright 2009-2020 - pancake */
#include <r_cmd.h>
#include <r_util.h>
@ -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);
}

View file

@ -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;
}

View file

@ -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);

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2019 - pancake */
/* radare - LGPL - Copyright 2009-2020 - pancake */
#include <r_core.h>
@ -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;

View file

@ -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;
}

View file

@ -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"));
}

View file

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;
}

View file

@ -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;

View file

@ -1,8 +1,8 @@
/* radare - LGPL - Copyright 2015-2017 - pancake, rkx1209 */
/* radare - LGPL - Copyright 2015-2020 - pancake, rkx1209 */
#include <r_debug.h>
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) {

View file

@ -1,10 +1,10 @@
/* radare - LGPL - Copyright 2008-2019 - pancake */
/* radare - LGPL - Copyright 2008-2020 - pancake */
#include <r_debug.h>
// 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;

View file

@ -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) {

View file

@ -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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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))

View file

@ -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));
}

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -26,7 +26,7 @@ static int usage (int v) {
return !v;
}
static int showversion() {
static int showversion(void) {
return r_main_version_print ("r2agent");
}

View file

@ -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++) {

View file

@ -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);

View file

@ -2,7 +2,7 @@
#include <r_main.h>
#include <r_core.h>
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"

View file

@ -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);

View file

@ -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"

View file

@ -25,7 +25,7 @@ static const char *lang =
"type : <qualifier>? <identifier> (<pointer> | <array>)*;";
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);
}
}

View file

@ -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;

View file

@ -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) {

View file

@ -36,11 +36,11 @@
~:$ cat example.c
#include <stdio.h>
void func() {
void func(void) {
printf("Hello ");
}
int main() {
int main(void) {
func(); func(); func();
}

View file

@ -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__

View file

@ -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"

View file

@ -1,4 +1,4 @@
/* radare - Copyright 2008-2018 - LGPL -- pancake */
/* radare - Copyright 2008-2020 - LGPL -- pancake */
#include <r_types.h>
#include <r_util.h>
@ -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;

View file

@ -1,9 +1,9 @@
/* radare - LGPL - Copyright 2019 - pancake */
/* radare - LGPL - Copyright 2019-2020 - pancake */
#include <r_util.h>
#include <r_util/r_alloc.h>
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

View file

@ -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;
}

View file

@ -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 <r_util.h>
// 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;

View file

@ -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;

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2007-2019 - pancake, ret2libc */
/* radare - LGPL - Copyright 2007-2020 - pancake, ret2libc */
#include <r_util.h>
@ -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;

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2008-2010 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2008-2020 pancake<nopcode.org> */
#include <r_util.h>
@ -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;

View file

@ -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);
}

View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include <r_regex.h>
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"));

View file

@ -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;
}

View file

@ -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__

View file

@ -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;

View file

@ -1,8 +1,8 @@
/* radare - LGPL - Copyright 2009-2018 - thestr4ng3r */
/* radare - LGPL - Copyright 2009-2020 - thestr4ng3r */
#include <r_th.h>
R_API RThreadCond *r_th_cond_new() {
R_API RThreadCond *r_th_cond_new(void) {
RThreadCond *cond = R_NEW0 (RThreadCond);
if (!cond) {
return NULL;

View file

@ -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;\

View file

@ -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 ());
}

View file

@ -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];

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
}

Some files were not shown because too many files have changed in this diff Show more