Minor refactoring involving string_filter()

This commit is contained in:
Khairul Kasmiran 2018-02-06 21:10:58 +08:00
parent d66df132e7
commit cb20c6eca6
3 changed files with 7 additions and 10 deletions

View File

@ -199,7 +199,7 @@ static bool false_positive(const char *str) {
return false;
}
R_API bool r_core_bin_strpurge(RCore *core, const char *str, ut64 refaddr) {
static bool strpurge(RCore *core, const char *str, ut64 refaddr) {
bool purge = false;
if (core->bin->strpurge) {
char *addrs = strdup (core->bin->strpurge);
@ -248,7 +248,7 @@ R_API bool r_core_bin_strpurge(RCore *core, const char *str, ut64 refaddr) {
return purge;
}
R_API bool r_core_bin_strfilter(RCore *core, const char *str) {
static bool strfilter(RCore *core, const char *str) {
int i;
switch (core->bin->strfilter) {
case 'U': // only uppercase strings
@ -359,9 +359,8 @@ R_API bool r_core_bin_strfilter(RCore *core, const char *str) {
return true;
}
static bool string_filter(RCore *core, const char *str, ut64 addr) {
if (r_core_bin_strpurge (core, str, addr)
|| !r_core_bin_strfilter (core, str)) {
R_API bool r_core_bin_string_filter(RCore *core, const char *str, ut64 addr) {
if (strpurge (core, str, addr) || !strfilter (core, str)) {
return false;
}
return true;
@ -397,7 +396,7 @@ static void _print_strings(RCore *r, RList *list, int mode, int va) {
paddr = string->paddr;
vaddr = r_bin_get_vaddr (bin, paddr, string->vaddr);
addr = va ? vaddr : paddr;
if (!string_filter (r, string->string, addr)) {
if (!r_core_bin_string_filter (r, string->string, addr)) {
continue;
}
if (string->length < minstr) {

View File

@ -3164,8 +3164,7 @@ static char *ds_esc_str(RDisasmState *ds, const char *str, int len, const char *
static void ds_print_str(RDisasmState *ds, const char *str, int len, ut64 refaddr) {
const char *prefix;
if (r_core_bin_strpurge (ds->core, str, refaddr)
|| !r_core_bin_strfilter (ds->core, str)) {
if (!r_core_bin_string_filter (ds->core, str, refaddr)) {
return;
}
char *escstr = ds_esc_str (ds, str, len, &prefix);

View File

@ -446,8 +446,7 @@ R_API bool r_core_bin_delete (RCore *core, ut32 binfile_idx, ut32 binobj_idx);
// XXX - this is kinda hacky, maybe there should be a way to
// refresh the bin environment without specific calls?
R_API int r_core_bin_refresh_strings(RCore *core);
R_API bool r_core_bin_strpurge(RCore *core, const char *str, ut64 addr);
R_API bool r_core_bin_strfilter(RCore *core, const char *str);
R_API bool r_core_bin_string_filter(RCore *core, const char *str, ut64 addr);
R_API int r_core_pseudo_code (RCore *core, const char *input);
/* gdiff.c */