Enforce weak/unowned linked lists by code, needs more testing

This commit is contained in:
pancake 2014-12-11 16:43:33 +01:00
parent 4c49708cf3
commit dd6b3005b1
3 changed files with 34 additions and 17 deletions

View File

@ -274,7 +274,11 @@ R_API void r_anal_trace_bb(RAnal *anal, ut64 addr) {
#endif
}
R_API RList* r_anal_get_fcns (RAnal *anal) { return anal->fcns; }
R_API RList* r_anal_get_fcns (RAnal *anal) {
// avoid received to free this thing
anal->fcns->free = NULL;
return anal->fcns;
}
R_API int r_anal_project_load(RAnal *anal, const char *prjfile) {
if (prjfile && *prjfile)

View File

@ -85,7 +85,10 @@ R_API void r_anal_fcn_free(void *_fcn) {
#if 0
r_list_free (fcn->locals);
#endif
fcn->bbs->free = (RListFree)r_anal_bb_free;
r_list_free (fcn->bbs);
fcn->bbs = NULL;
free (fcn->fingerprint);
r_anal_diff_free (fcn->diff);
free (fcn->args);
@ -957,7 +960,12 @@ R_API RList* r_anal_fcn_get_refs (RAnalFunction *anal) { return anal->refs; }
R_API RList* r_anal_fcn_get_xrefs (RAnalFunction *anal) { return anal->xrefs; }
R_API RList* r_anal_fcn_get_vars (RAnalFunction *anal) { return anal->vars; }
#endif
R_API RList* r_anal_fcn_get_bbs (RAnalFunction *anal) { return anal->bbs; }
R_API RList* r_anal_fcn_get_bbs (RAnalFunction *anal) {
// avoid received to free this thing
anal->bbs->free = NULL;
return anal->bbs;
}
R_API int r_anal_fcn_is_in_offset (RAnalFunction *fcn, ut64 addr) {
return (addr >= fcn->addr && addr < (fcn->addr+fcn->size));

View File

@ -3,25 +3,30 @@ cd `dirname $PWD/$0`
./clone-r2-bindings.sh
cd ../radare2-bindings
if [ -x /usr/bin/i686-w64-mingw32-gcc ]; then
C=i686-w64-mingw32-gcc
H=i686-unknown-windows
G=i686-w64-mingw32-g++
type i686-pc-mingw32-gcc >/dev/null 2>&1
if [ $? = 0 ]; then
C=i686-pc-mingw32-gcc
G=i686-pc-mingw32-gcc
H=i686-unknown-windows
elif [ -x /usr/bin/i686-w64-mingw32-gcc ]; then
C=i686-w64-mingw32-gcc
H=i686-unknown-windows
G=i686-w64-mingw32-g++
elif [ -x /usr/bin/pacman ]; then
C=i486-mingw32-gcc
H=i486-unknown-windows
G=i486-mingw32-g++
C=i486-mingw32-gcc
H=i486-unknown-windows
G=i486-mingw32-g++
elif [ `uname` = Darwin ]; then
C=i386-mingw32-gcc
H=i386-unknown-windows
G=i386-mingw32-g++
C=i386-mingw32-gcc
H=i386-unknown-windows
G=i386-mingw32-g++
elif [ -x /usr/bin/apt-get ]; then
C=i586-mingw32msvc-gcc
H=i586-unknown-windows
G=i586-mingw32msvc-g++
C=i586-mingw32msvc-gcc
H=i586-unknown-windows
G=i586-mingw32msvc-g++
else
echo "mingw32 required in some version, nothing found!"
exit 1
echo "mingw32 required in some version, nothing found!"
exit 1
fi
make clean