mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-03 20:22:38 +00:00
Fix #3191 - Fix // to repeat last search
This commit is contained in:
parent
bbf7a2221c
commit
72d442931d
@ -6,8 +6,7 @@
|
||||
#include <r_lib.h>
|
||||
#include "../arch/mcs96/mcs96.h"
|
||||
|
||||
static int mcs96_len (const ut8 buf)
|
||||
{
|
||||
static int mcs96_len (const ut8 buf) {
|
||||
if (mcs96_op[buf].type & MCS96_6B)
|
||||
return 6;
|
||||
if (mcs96_op[buf].type & MCS96_5B)
|
||||
@ -22,7 +21,7 @@ static int mcs96_len (const ut8 buf)
|
||||
}
|
||||
|
||||
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
strncpy (op->buf_asm, mcs96_op[buf[0]].ins, sizeof(op->buf_asm));
|
||||
strncpy (op->buf_asm, mcs96_op[buf[0]].ins, sizeof (op->buf_asm)-1);
|
||||
op->size = mcs96_len (buf[0]);
|
||||
return op->size;
|
||||
}
|
||||
|
@ -1556,7 +1556,7 @@ static void do_string_search(RCore *core, struct search_parameters *param) {
|
||||
|
||||
static int cmd_search(void *data, const char *input) {
|
||||
struct search_parameters param;
|
||||
_Bool dosearch = false;
|
||||
bool dosearch = false;
|
||||
int i, len, ret = true;
|
||||
RCore *core = (RCore *)data;
|
||||
int ignorecase = false;
|
||||
@ -1574,10 +1574,20 @@ static int cmd_search(void *data, const char *input) {
|
||||
eprintf ("Can't search from within a search.\n");
|
||||
return false;
|
||||
}
|
||||
if (input[0] == '/') {
|
||||
if (core->lastsearch) {
|
||||
input = core->lastsearch;
|
||||
} else {
|
||||
eprintf ("No previous search done\n");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
free (core->lastsearch);
|
||||
core->lastsearch = strdup (input);
|
||||
}
|
||||
|
||||
core->in_search = true;
|
||||
|
||||
r_flag_space_push(core->flags, "searches");
|
||||
|
||||
r_flag_space_push (core->flags, "searches");
|
||||
param.from = param.to = 0;
|
||||
param.inverse = false;
|
||||
param.crypto_search = false;
|
||||
@ -1763,10 +1773,6 @@ reread:
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case '/':
|
||||
r_search_begin (core->search);
|
||||
dosearch = true;
|
||||
break;
|
||||
case 'm': // "/m"
|
||||
dosearch = false;
|
||||
if (input[1]==' ' || input[1]=='\0') {
|
||||
|
@ -964,6 +964,7 @@ R_API RCore *r_core_fini(RCore *c) {
|
||||
/* TODO: it leaks as shit */
|
||||
//update_sdb (c);
|
||||
// avoid double free
|
||||
R_FREE (c->lastsearch);
|
||||
c->cons->pager = NULL;
|
||||
r_core_task_join (c, NULL);
|
||||
free (c->cmdqueue);
|
||||
|
@ -149,6 +149,7 @@ typedef struct r_core_t {
|
||||
Sdb *sdb;
|
||||
int incomment;
|
||||
int cmdremote;
|
||||
char *lastsearch;
|
||||
} RCore;
|
||||
|
||||
R_API int r_core_bind(RCore *core, RCoreBind *bnd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user