radare2/libr/core/gdiff.c
pancake 3d142e8ec1 * Initial import of the hashtable implementation of WayLand
- Kinda smart (150LOC)
  - Fork it for 64bit hash keys (make ht64 in libr/util)
* Make RConfig use the RHashTable to resolve by name
  - Code cleanup resulting in -30LOC
  - O(1) access to config variables (speedup!)
  - Make r_list_free and r_list_destroy take sense
2011-03-17 19:05:39 +01:00

41 lines
1.0 KiB
C

/* radare - LGPL - Copyright 2010-2011 - nibble<develsec.org> */
#include <stdio.h>
#include <string.h>
#include <r_anal.h>
#include <r_list.h>
#include <r_util.h>
#include <r_core.h>
R_API int r_core_gdiff(RCore *c, RCore *c2) {
RCore *cores[2] = {c, c2};
RAnalFcn *fcn;
RAnalBlock *bb;
RListIter *iter, *iter2;
int i;
for (i = 0; i < 2; i++) {
r_core_anal_all (cores[i]);
/* Fingerprint fcn bbs */
iter = r_list_iterator (cores[i]->anal->fcns);
while (r_list_iter_next (iter)) {
fcn = r_list_iter_get (iter);
iter2 = r_list_iterator (fcn->bbs);
while (r_list_iter_next (iter2)) {
bb = r_list_iter_get (iter2);
r_anal_diff_fingerprint_bb (cores[i]->anal, bb);
}
}
/* Fingerprint fcn */
iter = r_list_iterator (cores[i]->anal->fcns);
while (r_list_iter_next (iter)) {
fcn = r_list_iter_get (iter);
fcn->size = r_anal_diff_fingerprint_fcn (cores[i]->anal, fcn);
}
}
/* Diff functions */
r_anal_diff_fcn (cores[0]->anal, cores[0]->anal->fcns, cores[1]->anal->fcns);
return R_TRUE;
}