Open wargio opened 11 months ago
Currently rizin contains a lot of global variables, ideally we want to remove most of them.
Can be found via $ find librz/ -type f -name "*.c" -o -name "*.h" -o -name "*.inc" | xargs -I % ctags -x --c-kinds=v % | grep 'static ' | grep -v ' static const \|{\|\[\]' | grep -v ' const static \|{\|\[\]'
$ find librz/ -type f -name "*.c" -o -name "*.h" -o -name "*.inc" | xargs -I % ctags -x --c-kinds=v % | grep 'static ' | grep -v ' static const \|{\|\[\]' | grep -v ' const static \|{\|\[\]'
options variable 16 librz/util/sdb/src/main.c static ut32 options = SDB_OPTION_FS | SDB_OPTION_NOSTAMP; s variable 15 librz/util/sdb/src/main.c static Sdb *s = NULL; save variable 14 librz/util/sdb/src/main.c static int save = 0; is_interrupted_cb variable 35 librz/util/print.c static RzPrintIsInterruptedCallback is_interrupted_cb = NULL; crash_handler_cmd variable 498 librz/util/sys.c static char *crash_handler_cmd = NULL; env variable 39 librz/util/sys.c static char **env = NULL; fd2close variable 1563 librz/util/sys.c static HtUU *fd2close; is_child variable 1490 librz/util/sys.c static bool is_child = false; is_child variable 1567 librz/util/sys.c static bool is_child = false; sys_pipe_mutex variable 1489 librz/util/sys.c static RzThreadLock *sys_pipe_mutex; sys_pipe_mutex variable 1566 librz/util/sys.c static RzThreadLock *sys_pipe_mutex; portable_prefix variable 15 librz/util/path.c static char *portable_prefix = NULL; portable_prefix_mutex variable 17 librz/util/path.c static RzThreadLock *portable_prefix_mutex = NULL; portable_prefix_searched variable 16 librz/util/path.c static bool portable_prefix_searched = false; lpDeleteProcThreadAttributeList variable 35 librz/util/subprocess.c static DeleteProcThreadAttributeList_t lpDeleteProcThreadAttributeList = NULL; lpInitializeProcThreadAttributeList variable 33 librz/util/subprocess.c static InitializeProcThreadAttributeList_t lpInitializeProcThreadAttributeList = NULL; lpUpdateProcThreadAttribute variable 34 librz/util/subprocess.c static UpdateProcThreadAttribute_t lpUpdateProcThreadAttribute = NULL; dyn_forkpty variable 63 librz/socket/run.c static id_t (*dyn_forkpty)(int *amaster, char *name, struct termios *termp, struct winsize *winp) = NULL; dyn_login_tty variable 62 librz/socket/run.c static int (*dyn_login_tty)(int fd) = NULL; dyn_openpty variable 61 librz/socket/run.c static int (*dyn_openpty)(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) = NULL; breaked variable 7 librz/socket/socket_http_server.c static bool *breaked = NULL; default_plugin variable 10 librz/io/io_plugin.c static volatile RzIOPlugin *default_plugin = NULL; c_addr variable 26 librz/io/p/io_qnx.c static ut64 c_addr = UT64_MAX; c_buff variable 28 librz/io/p/io_qnx.c static ut8 *c_buff = NULL; c_size variable 27 librz/io/p/io_qnx.c static ut32 c_size = UT32_MAX; desc variable 17 librz/io/p/io_qnx.c static libqnxr_t *desc = NULL; rioqnx variable 18 librz/io/p/io_qnx.c static RzIODesc *rioqnx = NULL; w32_DebugConnectWide variable 20 librz/io/p/io_windbg.c static DebugConnectWide_t w32_DebugConnectWide = NULL; w32_DebugCreate variable 19 librz/io/p/io_windbg.c static DebugCreate_t w32_DebugCreate = NULL; desc variable 23 librz/io/p/io_gdb.c static libgdbr_t *desc = NULL; gs variable 13 librz/io/p/io_winedbg.c static RzSocket *gs = NULL; mameio variable 70 librz/io/p/io_self.c static bool mameio = false; self_sections variable 68 librz/io/p/io_self.c static RzIOSelfSection self_sections[1024]; self_sections_count variable 69 librz/io/p/io_self.c static int self_sections_count = 0; numbuf_i variable 2043 librz/core/tui/visual.c static int numbuf_i = 0; disMode variable 14 librz/core/agraph.c static int disMode = 0; discroll variable 15 librz/core/agraph.c static int discroll = 0; graphCursor variable 16 librz/core/agraph.c static bool graphCursor = false; mousemode variable 13 librz/core/agraph.c static int mousemode = 0; ck variable 8 librz/core/cmd/cmd_magic.c static RzMagic *ck = NULL; // XXX: Use RzCore->magic kw_count variable 10 librz/core/cmd/cmd_magic.c static int kw_count = 0; magicdepth variable 7 librz/core/cmd/cmd_magic.c static int magicdepth = 99; // XXX: do not use global var here ofile variable 9 librz/core/cmd/cmd_magic.c static char *ofile = NULL; c variable 531 librz/core/cmd/cmd_search.c static int c = 0; preludecnt variable 155 librz/core/cmd/cmd_search.c static int preludecnt = 0; searchflags variable 156 librz/core/cmd/cmd_search.c static int searchflags = 0; searchshow variable 157 librz/core/cmd/cmd_search.c static int searchshow = 0; _core variable 1326 librz/core/cmd/cmd_debug.c static RzCore *_core = NULL; LOOP_CONTINUE_VALUE variable 7 librz/core/rtr_http.c static int LOOP_CONTINUE_VALUE = 66; RtlpHpHeapGlobalsOffset variable 58 librz/core/windows_heap.c static size_t RtlpHpHeapGlobalsOffset = 0; RtlpLFHKeyOffset variable 59 librz/core/windows_heap.c static size_t RtlpLFHKeyOffset = 0; rapthread variable 26 librz/core/rtr.c static RzThread *rapthread = NULL; s variable 25 librz/core/rtr.c static RzSocket *s = NULL; lasti variable 1773 librz/cons/cons.c static bool lasti = false; /* last interactive mode */ w32_GetFileInformationByHandleEx variable 1552 librz/cons/cons.c static GetFileInformationByHandleEx_t w32_GetFileInformationByHandleEx; has_match variable 24 librz/debug/desil.c static int has_match = 0; opc variable 26 librz/debug/desil.c static ut64 opc = 0; prestep variable 25 librz/debug/desil.c static int prestep = 1; // TODO: make it configurable buf_size variable 35 librz/debug/p/debug_qnx.c static int buf_size = 0; desc variable 33 librz/debug/p/debug_qnx.c static libqnxr_t *desc = NULL; reg_buf variable 34 librz/debug/p/debug_qnx.c static ut8 *reg_buf = NULL; do_break variable 137 librz/debug/p/debug_windbg.c static bool do_break = false; note_info variable 40 librz/debug/p/native/linux/linux_coredump.c static note_info_t note_info[NT_LENGHT_T]; breaked variable 815 librz/debug/p/native/windows/windows_debug.c static bool breaked = false; lib_list variable 12 librz/debug/p/native/windows/windows_debug.c static RzList *lib_list = NULL; kdctx variable 13 librz/debug/p/debug_winkd.c static KdCtx *kdctx = NULL; magic_file_formats variable 75 librz/magic/apprentice.c static int magic_file_formats[FILE_NAMES_SIZE]; magicsize variable 103 librz/magic/apprentice.c static size_t magicsize = sizeof(struct rz_magic); maxmagic variable 102 librz/magic/apprentice.c static size_t maxmagic = 0; openssl_lib variable 44 librz/hash/hash.c static RzHashOpenSSL *openssl_lib = NULL; mips_cp0sel_names_len variable 458 librz/arch/isa_gnu/mips/mips-dis.c static int mips_cp0sel_names_len; mips_isa variable 453 librz/arch/isa_gnu/mips/mips-dis.c static int mips_isa; mips_processor variable 452 librz/arch/isa_gnu/mips/mips-dis.c static int mips_processor; no_aliases variable 462 librz/arch/isa_gnu/mips/mips-dis.c static int no_aliases; /* If set disassemble as most general inst. */ bfd_riscv_num_opcodes variable 687 librz/arch/isa_gnu/riscv/riscv-opc.c static int bfd_riscv_num_opcodes = RISCV_NUM_OPCODES; riscv_opcodes variable 685 librz/arch/isa_gnu/riscv/riscv-opc.c static struct riscv_opcode *riscv_opcodes = init_asm variable 41 librz/arch/isa_gnu/riscv/riscv.c static bool init_asm = 0; case_offset variable 97 librz/arch/isa_gnu/cris/cris-dis.c static long case_offset = 0; case_offset_counter variable 100 librz/arch/isa_gnu/cris/cris-dis.c static long case_offset_counter = 0; last_immediate variable 106 librz/arch/isa_gnu/cris/cris-dis.c static long last_immediate = 0; no_of_case_offsets variable 103 librz/arch/isa_gnu/cris/cris-dis.c static long no_of_case_offsets = 0; opcodes_sorted variable 117 librz/arch/isa_gnu/lanai/lanai-dis.c static int opcodes_sorted = 0; arc_extension_map variable 108 librz/arch/isa_gnu/arc/arc-ext.c static struct arcExtMap arc_extension_map; addrwb_p variable 113 librz/arch/isa_gnu/arc/arc-opc.c static int addrwb_p; arc_operand_map_a4 variable 148 librz/arch/isa_gnu/arc/arc-opc.c static unsigned char arc_operand_map_a4[256]; arc_operand_map_ac variable 149 librz/arch/isa_gnu/arc/arc-opc.c static unsigned char arc_operand_map_ac[256]; cpu_type variable 143 librz/arch/isa_gnu/arc/arc-opc.c static int cpu_type; flag_p variable 107 librz/arch/isa_gnu/arc/arc-opc.c static int flag_p; flagshimm_handled_p variable 110 librz/arch/isa_gnu/arc/arc-opc.c static int flagshimm_handled_p; icode_map variable 4272 librz/arch/isa_gnu/arc/arc-opc.c static struct arc_opcode *icode_map[32]; jumpflags_p variable 122 librz/arch/isa_gnu/arc/arc-opc.c static int jumpflags_p; limm variable 137 librz/arch/isa_gnu/arc/arc-opc.c static long limm; limm_p variable 133 librz/arch/isa_gnu/arc/arc-opc.c static int limm_p; ls_operand variable 154 librz/arch/isa_gnu/arc/arc-opc.c static enum operand ls_operand[OPERANDS]; nullify variable 119 librz/arch/isa_gnu/arc/arc-opc.c static int nullify; nullify_p variable 116 librz/arch/isa_gnu/arc/arc-opc.c static int nullify_p; opcode_map variable 4269 librz/arch/isa_gnu/arc/arc-opc.c static struct arc_opcode *opcode_map[26 + 1]; shimm variable 129 librz/arch/isa_gnu/arc/arc-opc.c static int shimm; shimm_p variable 125 librz/arch/isa_gnu/arc/arc-opc.c static int shimm_p; enable_insn_stream variable 283 librz/arch/isa_gnu/arc/arcompact-dis.c static short int enable_insn_stream = 0; enable_simd variable 282 librz/arch/isa_gnu/arc/arcompact-dis.c static short int enable_simd = 0; current_arch_mask variable 225 librz/arch/isa_gnu/sparc/sparc-dis.c static unsigned int current_arch_mask; opcode_hash_table variable 71 librz/arch/isa_gnu/sparc/sparc-dis.c static sparc_opcode_hash *opcode_hash_table[HASH_SIZE]; has_failed variable 9 librz/arch/isa/tms320/c55x_plus/ins.c static unsigned int has_failed = 0; _state variable 13 librz/arch/isa/xap/dis.c static struct state _state; err variable 435 librz/arch/isa/arm/armass.c static bool err; Offset variable 18 librz/arch/p_gnu/asm/asm_vax_gnu.c static unsigned long Offset = 0; buf_global variable 19 librz/arch/p_gnu/asm/asm_vax_gnu.c static RzStrBuf *buf_global = NULL; bytes_size variable 21 librz/arch/p_gnu/asm/asm_vax_gnu.c static int bytes_size = 0; buf_global variable 18 librz/arch/p_gnu/asm/asm_xtensa_gnu.c static RzStrBuf *buf_global = NULL; bytes variable 19 librz/arch/p_gnu/asm/asm_xtensa_gnu.c static ut8 bytes[INSN_BUFFER_SIZE]; offset variable 17 librz/arch/p_gnu/asm/asm_xtensa_gnu.c static ut64 offset = 0; Offset variable 15 librz/arch/p_gnu/asm/asm_hppa_gnu.c static unsigned long Offset = 0; buf_global variable 16 librz/arch/p_gnu/asm/asm_hppa_gnu.c static RzStrBuf *buf_global = NULL; bytes variable 17 librz/arch/p_gnu/asm/asm_hppa_gnu.c static unsigned char bytes[4]; Offset variable 14 librz/arch/p_gnu/asm/asm_sparc_gnu.c static unsigned long Offset = 0; buf_global variable 15 librz/arch/p_gnu/asm/asm_sparc_gnu.c static RzStrBuf *buf_global = NULL; bytes variable 16 librz/arch/p_gnu/asm/asm_sparc_gnu.c static unsigned char bytes[4]; Offset variable 24 librz/arch/p_gnu/asm/asm_cris_gnu.c static unsigned long Offset = 0; buf_global variable 25 librz/arch/p_gnu/asm/asm_cris_gnu.c static RzStrBuf *buf_global = NULL; bytes variable 26 librz/arch/p_gnu/asm/asm_cris_gnu.c static unsigned char bytes[8]; Offset variable 20 librz/arch/p_gnu/asm/asm_arc_gnu.c static ut32 Offset = 0; buf_global variable 21 librz/arch/p_gnu/asm/asm_arc_gnu.c static RzStrBuf *buf_global = NULL; buf_len variable 22 librz/arch/p_gnu/asm/asm_arc_gnu.c static int buf_len = 0; Offset variable 13 librz/arch/p_gnu/asm/asm_lanai_gnu.c static unsigned long Offset = 0; buf_global variable 14 librz/arch/p_gnu/asm/asm_lanai_gnu.c static RzStrBuf *buf_global = NULL; bytes variable 15 librz/arch/p_gnu/asm/asm_lanai_gnu.c static unsigned char bytes[4]; Offset variable 20 librz/arch/p_gnu/asm/asm_mips_gnu.c static unsigned long Offset = 0; buf_global variable 21 librz/arch/p_gnu/asm/asm_mips_gnu.c static RzStrBuf *buf_global = NULL; bytes variable 22 librz/arch/p_gnu/asm/asm_mips_gnu.c static unsigned char bytes[4]; mips_mode variable 19 librz/arch/p_gnu/asm/asm_mips_gnu.c static int mips_mode = 0; pre_cpu variable 23 librz/arch/p_gnu/asm/asm_mips_gnu.c static char *pre_cpu = NULL; pre_features variable 24 librz/arch/p_gnu/asm/asm_mips_gnu.c static char *pre_features = NULL; init_analysis variable 19 librz/arch/p_gnu/analysis/analysis_riscv_gnu.c static bool init_analysis = false; t9_pre variable 10 librz/arch/p_gnu/analysis/analysis_mips_gnu.c static ut64 t9_pre = UT64_MAX; opcodes_cache variable 12 librz/arch/p/asm/asm_pyc.c static pyc_opcodes *opcodes_cache = NULL; t9_pre variable 9 librz/arch/p/analysis/analysis_mips_cs.c static ut64 t9_pre = UT64_MAX; addr_old variable 18 librz/arch/p/analysis/analysis_wasm.c static ut64 addr_old = UT64_MAX; scope_hint variable 17 librz/arch/p/analysis/analysis_wasm.c static ut64 scope_hint = UT64_MAX; cpu_enable variable 10 librz/arch/p/analysis/analysis_or1k.c static ut32 cpu_enable; /* allows to treat only registers with known value as base_regs variable 868 librz/arch/p/analysis/analysis_ppc_cs.c static RzRegItem base_regs[4]; hPipeInOut variable 32 librz/lang/p/pipe_helper.c static HANDLE hPipeInOut = NULL; hproc variable 33 librz/lang/p/pipe_helper.c static HANDLE hproc = NULL; ac variable 13 librz/lang/p/c.c static int ac = 0; cb variable 15 librz/bin/p/bin_sms.c static ut32 cb = 0; n64_header variable 67 librz/bin/p/bin_z64.c static N64Header n64_header; tmp_entry variable 22 librz/bin/p/bin_avr.c static ut64 tmp_entry = UT64_MAX; lastarg variable 20 librz/egg/emit_arm.c static int lastarg = 0; lastargs variable 21 librz/egg/emit_arm.c static char lastargs[16][32];
Extra via command: grep -R -e '^\s\+static.\+;' . | grep '\.c:\|\.inc:' | grep -v -e 'static const\|static inline\|./subprojects/\|/test/'
grep -R -e '^\s\+static.\+;' . | grep '\.c:\|\.inc:' | grep -v -e 'static const\|static inline\|./subprojects/\|/test/'
./librz/main/rz-bin.c: static char *stdin_buf = NULL; ./librz/util/sdb/src/fmt.c: static char Key[KN][KL]; ./librz/util/sdb/src/fmt.c: static int n = 0; ./librz/util/sdb/src/main.c: static int bufsize = BS; ./librz/util/sdb/src/main.c: static char *next = NULL; ./librz/util/sdb/src/main.c: static size_t nextlen = 0; ./librz/util/sdb/src/lock.c: static char buf[128]; ./librz/util/sys.c: static bool win_ver_initialized = false; ./librz/util/sys.c: static bool is_win_7_or_greater = false; ./librz/util/unum.c: static bool rand_initialized = false; ./librz/util/unum.c: static bool rand_initialized = false; ./librz/util/time.c: static int tzflag = 0; ./librz/util/float/float.c: static ftype zero = 0; \ ./librz/util/float/float.c: static ftype zero = 0; \ ./librz/util/float/float.c: static ftype one = 1.0; \ ./librz/io/p/io_mach.c: static task_t old_task = 0; ./librz/io/p/io_mach.c: static int old_pid = -1; ./librz/io/p/io_mach.c: static vm_size_t pagesize = 0; ./librz/core/tui/vmenus.c: static int sortMode = 0; ./librz/core/tui/visual.c: static RzConfigHold *hold = NULL; // should be a tab-specific var ./librz/core/tui/visual.c: static ut64 oldpc = 0; ./librz/core/tui/visual.c: static ut64 oseek = UT64_MAX; ./librz/core/tui/visual.c: static char debugstr[512]; ./librz/core/tui/visual.c: static char debugstr[512]; ./librz/core/cmd/cmd_shell.c: static int needs_newline = 0; ./librz/core/cmd/cmd_shell.c: static int needs_newline = 0; ./librz/core/cmd/cmd_shell.c: static char *olddir = NULL; ./librz/core/cmd/cmd.c: static RzCmdStatus handle_ts_##name##_internal(struct tsr2cmd_state *state, TSNode node, char *node_string); \ ./librz/core/cmd/cmd.c: static_str = rz_cons_get_buffer(); ./librz/core/cmd/cmd.c: static_str = rz_cons_get_buffer(); ./librz/cons/grep.c: static char buf[RZ_CONS_GREP_BUFSIZE]; ./librz/cons/less.c: static int in_help = false; ./librz/cons/cons.c: static RzStrBuf *echodata = NULL; // TODO: move into RzConsInstance? maybe nope ./librz/cons/cons.c: static HANDLE hStdout = NULL; ./librz/cons/cons.c: static DWORD size = -1; ./librz/cons/cons.c: static int oldraw = -1; ./librz/cons/output.c: static HANDLE hStdout = NULL; ./librz/cons/output.c: static CONSOLE_SCREEN_BUFFER_INFO csbi; ./librz/cons/output.c: static HANDLE hStdout = NULL; ./librz/cons/output.c: static HANDLE hStderr = NULL; ./librz/debug/debug.c: static bool (*linux_attach_new_process)(RzDebug *dbg, int pid) = NULL; ./librz/debug/trace.c: static ut64 oldpc = UT64_MAX; // Must trace the previously traced instruction ./librz/debug/p/debug_windbg.c: static volatile LONG bp_idx = 0; ./librz/debug/p/native/linux/linux_coredump.c: static size_t size_note_hdr = sizeof(elf_nhdr_t); ./librz/debug/p/native/bt/windows-all.c: static bool initialized = false; ./librz/debug/p/native/bt/windows-all.c: static RzThreadLock *lock = NULL; ./librz/debug/p/native/xnu/xnu_excthreads.c: static ut64 chained_address = 0; // TODO: static is bad, move this into RzXnuDebug or handle differently somehow ./librz/debug/p/native/windows/windows_debug.c: static int exited_already = 0; ./librz/debug/p/native/windows/windows_message.c: static Sdb *msg_types = NULL; ./librz/magic/mdump.c: static int daylight = 0; ./librz/magic/mdump.c: static time_t now = (time_t)0; ./librz/magic/apprentice.c: static bool done = false; ./librz/magic/apprentice.c: static ut32 last_cont_level = 0; ./librz/arch/isa_gnu/mips/mips-dis.c: static unsigned long hint_bfd_mach; ./librz/arch/isa_gnu/mips/mips-dis.c: static bfd_boolean init = 0; ./librz/arch/isa_gnu/mips/mips-dis.c: statics = 0; ./librz/arch/isa_gnu/mips/mips-dis.c: statics = 4; ./librz/arch/isa_gnu/mips/mips-dis.c: statics = amask & 3; ./librz/arch/isa_gnu/xtensa/xtensa-dis.c: static bfd_byte *byte_buf = NULL; ./librz/arch/isa_gnu/xtensa/xtensa-dis.c: static xtensa_insnbuf insn_buffer = NULL; ./librz/arch/isa_gnu/xtensa/xtensa-dis.c: static xtensa_insnbuf slot_buffer = NULL; ./librz/arch/isa_gnu/xtensa/xtensa-isa.c: static int max_stage = XTENSA_UNDEFINED; ./librz/arch/isa_gnu/xtensa/xtensa-isa.c: static xtensa_insnbuf tmpbuf = 0; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf ibuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf sbuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static bfd_size_type alloc_size = 0; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static char *message = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf ibuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf sbuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static bfd_boolean done_lookup = FALSE; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_opcode const16_opcode = XTENSA_UNDEFINED; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_opcode l32r_opcode = XTENSA_UNDEFINED; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static bfd_boolean done_lookup = FALSE; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf ibuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf sbuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf ibuff = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf o_insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf o_slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf o_insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf o_slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf slotbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static value_map_hash_table *values = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static bfd_boolean relocations_analyzed = FALSE; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf insnbuf = NULL; ./librz/arch/isa_gnu/xtensa/elf32-xtensa.c: static xtensa_insnbuf slotbuf = NULL; ./librz/arch/isa_gnu/arc/arc-dis.c: static char id[3 * ARRAY_SIZE(state->addresses)]; ./librz/arch/isa_gnu/arc/arc-opc.c: static char buf[100]; ./librz/arch/isa_gnu/arc/arc-opc.c: static int init_p = 0; ./librz/arch/isa_gnu/arc/arcompact-dis.c: static char id[3 * _NELEM(state->addresses)]; ./librz/arch/isa_gnu/sparc/sparc-dis.c: static sparc_opcode_hash *hash_buf = NULL; ./librz/arch/isa_gnu/sparc/sparc-dis.c: static int opcodes_initialized = 0; ./librz/arch/isa_gnu/sparc/sparc-dis.c: static unsigned long current_mach = 0; ./librz/arch/isa/avr/avr_esil.c: static CPU_MODEL *cpu = NULL; ./librz/arch/isa/hexagon/hexagon_arch.c: static HexState *state = NULL; ./librz/arch/isa/hexagon/hexagon_il.c: static bool might_has_jumped = false; ./librz/egg/egg_lang.c: static char label[128]; ./librz/egg/egg_lang.c: static char label[128]; ./librz/type/format.c: static int slide = 0, oldslide = 0, ident = 4;
Linked to https://github.com/rizinorg/rizin/issues/276
This seems to miss some. E.g. the internal plugin state for Hexagon.
@wargio please update the issue since I removed a bunch of those.
updated
Currently rizin contains a lot of global variables, ideally we want to remove most of them.
Can be found via
$ find librz/ -type f -name "*.c" -o -name "*.h" -o -name "*.inc" | xargs -I % ctags -x --c-kinds=v % | grep 'static ' | grep -v ' static const \|{\|\[\]' | grep -v ' const static \|{\|\[\]'
Extra via command:
grep -R -e '^\s\+static.\+;' . | grep '\.c:\|\.inc:' | grep -v -e 'static const\|static inline\|./subprojects/\|/test/'