radare2/libr/anal/aop.c
Nibble 68aeb6f92a * Add targets clean & mrproper to binr/Makefile
* Use r_list_free instead of r_list_destroy in r_anal
* Some minor fixups in r_anal
2010-06-14 18:29:52 +02:00

40 lines
798 B
C

/* radare - LGPL - Copyright 2010 */
/* nibble<.ds@gmail.com> */
/* pancake<nopcode.org> */
#include <r_anal.h>
#include <r_util.h>
#include <r_list.h>
R_API RAnalOp *r_anal_aop_new() {
RAnalOp *aop;
aop = R_NEW (RAnalOp);
if (aop) {
memset (aop, 0, sizeof (RAnalOp));
aop->mnemonic = NULL;
aop->addr = -1;
aop->jump = -1;
aop->fail = -1;
}
return aop;
}
R_API RList *r_anal_aop_list_new() {
RList *list = r_list_new ();
list->free = r_anal_aop_free;
return list;
}
R_API void r_anal_aop_free(void *aop) {
if (aop)
free (((RAnalOp*)aop)->mnemonic);
free (aop);
}
R_API int r_anal_aop(RAnal *anal, RAnalOp *aop, ut64 addr, const ut8 *data, int len) {
if (anal && aop && anal->cur && anal->cur->aop)
return anal->cur->aop (anal, aop, addr, data, len);
return 0;
}