本文整理汇总了C++中r_list_free函数的典型用法代码示例。如果您正苦于以下问题:C++ r_list_free函数的具体用法?C++ r_list_free怎么用?C++ r_list_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了r_list_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_list_new
R_API RList *r_anal_refs_get (RAnal *anal, ut64 from) {
RList *list = r_list_new ();
if (!list) {
return NULL;
}
r_anal_xrefs_from (anal, list, "ref", R_ANAL_REF_TYPE_NULL, from);
r_anal_xrefs_from (anal, list, "ref", R_ANAL_REF_TYPE_CODE, from);
r_anal_xrefs_from (anal, list, "ref", R_ANAL_REF_TYPE_CALL, from);
r_anal_xrefs_from (anal, list, "ref", R_ANAL_REF_TYPE_DATA, from);
r_anal_xrefs_from (anal, list, "ref", R_ANAL_REF_TYPE_STRING, from);
if (r_list_empty (list)) {
r_list_free (list);
list = NULL;
}
return list;
}
示例2: r_bflt_get_entry
static RList *entries(RBinFile *bf) {
struct r_bin_bflt_obj *obj = (struct r_bin_bflt_obj *) bf->o->bin_obj;
RList *ret;
RBinAddr *ptr;
if (!(ret = r_list_newf (free))) {
return NULL;
}
ptr = r_bflt_get_entry (obj);
if (!ptr) {
r_list_free (ret);
return NULL;
}
r_list_append (ret, ptr);
return ret;
}
示例3: r_anal_bb_free
R_API void r_anal_bb_free(RAnalBlock *bb) {
if (!bb) return;
r_anal_cond_free (bb->cond);
free (bb->fingerprint);
if (bb->diff)
r_anal_diff_free (bb->diff);
#if R_ANAL_BB_HAS_OPS
if (bb->ops)
r_list_free (bb->ops);
bb->ops = NULL;
bb->diff = NULL;
#endif
bb->fingerprint = NULL;
bb->cond = NULL;
free (bb);
}
示例4: r_buf_deinit
R_API void r_buf_deinit(RBuffer *b) {
if (!b) return;
if (b->fd != -1) {
r_sandbox_close (b->fd);
b->fd = -1;
return;
}
if (b->sparse) {
r_list_free (b->sparse);
b->sparse = NULL;
}
if (b->mmap) {
r_file_mmap_free (b->mmap);
b->mmap = NULL;
} else R_FREE (b->buf);
}
示例5: r_list_free
static RList *imports(RBinFile *arch) {
RBinWasmObj *bin = NULL;
RList *imports = NULL;
RBinImport *ptr = NULL;
RList *ret = NULL;
if (!arch || !arch->o || !arch->o->bin_obj) {
return NULL;
}
bin = arch->o->bin_obj;
if (!(ret = r_list_newf (r_bin_import_free))) {
return NULL;
}
if (!(imports = r_bin_wasm_get_imports (bin))) {
r_list_free (ret);
return NULL;
}
RBinWasmImportEntry *import = NULL;
ut32 i = 0;
RListIter *iter;
r_list_foreach (imports, iter, import) {
if (!(ptr = R_NEW0 (RBinImport))) {
break;
}
ptr->name = strdup (import->field_str);
ptr->classname = strdup (import->module_str);
ptr->ordinal = i;
ptr->bind = r_str_const ("NONE");
switch(import->kind) {
case R_BIN_WASM_EXTERNALKIND_Function:
ptr->type = r_str_const ("FUNC");
break;
case R_BIN_WASM_EXTERNALKIND_Table:
ptr->type = r_str_const ("TABLE");
break;
case R_BIN_WASM_EXTERNALKIND_Memory:
ptr->type = r_str_const ("MEM");
break;
case R_BIN_WASM_EXTERNALKIND_Global:
ptr->type = r_str_const ("GLOBAL");
break;
}
r_list_append (ret, ptr);
}
return ret;
}
示例6: radare2_rc
static void radare2_rc(RCore *r) {
char* env_debug = r_sys_getenv ("R_DEBUG");
bool has_debug = false;
if (env_debug) {
has_debug = true;
R_FREE (env_debug);
}
char *homerc = r_str_home (".radare2rc");
if (homerc && r_file_is_regular (homerc)) {
if (has_debug) {
eprintf ("USER CONFIG loaded from %s\n", homerc);
}
r_core_cmd_file (r, homerc);
}
free (homerc);
homerc = r_str_home (".config/radare2/radare2rc");
if (homerc && r_file_is_regular (homerc)) {
if (has_debug) {
eprintf ("USER CONFIG loaded from %s\n", homerc);
}
r_core_cmd_file (r, homerc);
}
free (homerc);
homerc = r_str_home (".config/radare2/radare2rc.d");
if (homerc) {
if (r_file_is_directory (homerc)) {
char *file;
RListIter *iter;
RList *files = r_sys_dir (homerc);
r_list_foreach (files, iter, file) {
if (*file != '.') {
char *path = r_str_newf ("%s/%s", homerc, file);
if (r_file_is_regular (path)) {
if (has_debug) {
eprintf ("USER CONFIG loaded from %s\n", homerc);
}
r_core_cmd_file (r, path);
}
free (path);
}
}
r_list_free (files);
}
free (homerc);
}
}
示例7: strdup
- follow symlinks
#endif
static char *rtr_dir_files (const char *path) {
char *ptr = strdup ("<html><body>\n");
const char *file;
RListIter *iter;
// list files
RList *files = r_sys_dir (path);
eprintf ("Listing directory %s\n", path);
r_list_foreach (files, iter, file) {
if (file[0] == '.') continue;
ptr = r_str_concatf (ptr, "<a href=\"%s%s\">%s</a><br />\n",
path, file, file);
}
r_list_free (files);
return r_str_concat (ptr, "</body></html>\n");
}
示例8: test_r_list_sort2
bool test_r_list_sort2(void) {
RList* list = r_list_new ();
char* test1 = "AAAA";
char* test2 = "BBBB";
char* test3 = "CCCC";
// Put in not sorted order.
r_list_append (list, (void*)test3);
r_list_append (list, (void*)test2);
r_list_append (list, (void*)test1);
// Sort.
r_list_merge_sort (list, (RListComparator)strcmp);
// Check that the list is actually sorted.
mu_assert_streq ((char*)list->head->data, "AAAA", "first value in sorted list");
mu_assert_streq ((char*)list->head->n->data, "BBBB", "second value in sorted list");
mu_assert_streq ((char*)list->head->n->n->data, "CCCC", "third value in sorted list");
r_list_free (list);
mu_end;
}
示例9: r_list_new
static RList *r_debug_native_threads (RDebug *dbg, int pid) {
RList *list = r_list_new ();
if (list == NULL) {
eprintf ("No list?\n");
return NULL;
}
#if __WINDOWS__ && !__CYGWIN__
return w32_thread_list (pid, list);
#elif __APPLE__
return xnu_thread_list (dbg, pid, list);
#elif __linux__
return linux_thread_list (pid, list);
#else
eprintf ("TODO: list threads\n");
r_list_free (list);
return NULL;
#endif
}
示例10: test_r_list_sort3
bool test_r_list_sort3(void) {
RList* list = r_list_new ();
int test1 = 33508;
int test2 = 33480;
int test3 = 33964;
// Put in not sorted order.
r_list_append (list, (void*)&test1);
r_list_append (list, (void*)&test3);
r_list_append (list, (void*)&test2);
// Sort.
r_list_merge_sort (list, (RListComparator)cmp_range);
// Check that the list is actually sorted.
mu_assert_eq (*(int*)list->head->data, 33480, "first value in sorted list");
mu_assert_eq (*(int*)list->head->n->data, 33508, "second value in sorted list");
mu_assert_eq (*(int*)list->head->n->n->data, 33964, "third value in sorted list");
r_list_free (list);
mu_end;
}
示例11: entries
static RList* entries(RBinFile *bf) {
RList* ret = r_list_newf (free);
RBinAddr *ptr = NULL;
if (ret) {
if ((ptr = R_NEW0 (RBinAddr))) {
ut64 entry = (ut64)readLE32(bf->buf, 0x80);
ut64 size = (ut64)readLE32(bf->buf, 0x84);
// eprintf ("0x%x 0x%x\n", entry, size);
ptr->paddr = entry;
ptr->vaddr = entry;
r_list_append (ret, ptr);
} else {
r_list_free (ret);
ret = NULL;
}
}
return ret;
}
示例12: test_r_list_sort5
bool test_r_list_sort5(void) {
RList* list = r_list_new ();
int i = 0;
char *upper[] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
char *lower[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
for (i = 0; i < 26; i++) {
r_list_append (list, (void *)lower[i]);
}
for (i = 0; i < 26; i++) {
r_list_append (list, (void *)upper[i]);
}
//add more than 43 elements to trigger merge sort
r_list_sort (list, (RListComparator)strcmp);
mu_assert_streq ((char *)list->head->data, upper[0], "First element");
mu_assert_streq ((char *)list->tail->data, lower[25], "Last element");
r_list_free (list);
mu_end;
}
示例13: entries
static RList* entries(RBinFile *arch) {
RList* ret = r_list_newf (free);
RBinAddr *ptr = NULL;
if (ret) {
if ((ptr = R_NEW0 (RBinAddr))) {
ut64 entry = findEntry (arch->buf, 2);
if (!entry) entry = findEntry (arch->buf, 1);
if (!entry) entry = findEntry (arch->buf, 0);
if (!entry) entry = 4;
ptr->paddr = entry;
ptr->vaddr = entry;
r_list_append (ret, ptr);
} else {
r_list_free (ret);
ret = NULL;
}
}
return ret;
}
示例14: r_list_newf
static RList *r_debug_bochs_map_get(RDebug* dbg) { //TODO
//eprintf("bochs_map_getdebug:\n");
RDebugMap *mr;
RList *list = r_list_newf ((RListFree)map_free);
if (!list) return NULL;
mr = R_NEW0 (RDebugMap);
if (!mr) {
r_list_free (list);
return NULL;
}
mr->name = strdup ("fake");
mr->addr = 0;
mr->addr_end = UT32_MAX;
mr->size = UT32_MAX;
mr->perm = 0;
mr->user = 0;
r_list_append (list, mr);
return list;
}
示例15: r_core_asm_bwdis_len
/* Compute the len and the starting address
* when disassembling `nb` opcodes backward. */
R_API ut32 r_core_asm_bwdis_len (RCore* core, int* instr_len, ut64* start_addr, ut32 nb) {
ut32 instr_run = 0;
RCoreAsmHit *hit;
RListIter *iter = NULL;
RList* hits = r_core_asm_bwdisassemble (core, core->offset, nb, core->blocksize);
if (instr_len)
*instr_len = 0;
if (hits && r_list_length (hits) > 0) {
hit = r_list_get_bottom (hits);
if (start_addr)
*start_addr = hit->addr;
r_list_foreach (hits, iter, hit)
instr_run += hit->len;
if (instr_len)
*instr_len = instr_run;
}
r_list_free (hits);
return instr_run;
}