本文整理汇总了C++中R_NEW函数的典型用法代码示例。如果您正苦于以下问题:C++ R_NEW函数的具体用法?C++ R_NEW怎么用?C++ R_NEW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_NEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: entries
static RList* entries(RBinArch *arch) {
RBinAddr *ptr;
RList *ret = r_list_new ();
if (!ret) return NULL;
ret->free = free;
if (!(ptr = R_NEW (RBinAddr)))
return ret;
memset (ptr, '\0', sizeof (RBinAddr));
ptr->offset = ptr->rva = r_bin_java_get_entrypoint (arch->bin_obj);
r_list_append (ret, ptr);
return ret;
}
示例2: binsym
static RBinAddr* binsym(RBinFile *arch, int type) {
RBinAddr *ret = NULL;
switch (type) {
case R_BIN_SYM_MAIN:
if (!(ret = R_NEW (RBinAddr)))
return NULL;
memset (ret, '\0', sizeof (RBinAddr));
ret->offset = ret->rva = r_bin_te_get_main_offset (arch->o->bin_obj);
break;
}
return ret;
}
示例3: R_NEW
R_API RAnalOp *r_anal_op_copy (RAnalOp *op) {
RAnalOp *nop = R_NEW (RAnalOp);
*nop = *op;
nop->mnemonic = strdup (op->mnemonic);
nop->src[0] = r_anal_value_copy (op->src[0]);
nop->src[1] = r_anal_value_copy (op->src[1]);
nop->src[2] = r_anal_value_copy (op->src[2]);
nop->dst = r_anal_value_copy (op->dst);
r_strbuf_init (&nop->esil);
r_strbuf_set (&nop->esil, r_strbuf_get (&op->esil));
return nop;
}
示例4: r_syscall_new
R_API RSyscall* r_syscall_new() {
RSyscall *rs = R_NEW (RSyscall);
if (rs) {
rs->fd = NULL;
rs->sysptr = NULL; //syscalls_linux_x86;
rs->sysport = sysport_x86;
rs->syspair = NULL;
rs->printf = (PrintfCallback)printf;
rs->regs = fastcall_x86;
}
return rs;
}
示例5: R_NEW
R_API struct r_th_lock_t *r_th_lock_new() {
RThreadLock *thl = R_NEW(RThreadLock);
if (thl) {
thl->refs = 0;
#if HAVE_PTHREAD
pthread_mutex_init (&thl->lock, NULL);
#elif __WIN32__
//thl->lock = CreateSemaphore(NULL, 0, 1, NULL);
InitializeCriticalSection(&thl->lock);
#endif
}
return thl;
}
示例6: R_NEW
R_API RThreadLock *r_th_lock_new() {
RThreadLock *thl = R_NEW(RThreadLock);
if (thl) {
thl->refs = 0;
#if HAVE_PTHREAD
pthread_mutex_init (&thl->lock, NULL);
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
//thl->lock = CreateSemaphore(NULL, 0, 1, NULL);
InitializeCriticalSection(&thl->lock);
#endif
}
return thl;
}
示例7: entries
static RList* entries(RBinFile *arch) {
RList* ret = r_list_new ();;
RBinAddr *ptr = NULL;
if (!ret) return NULL;
ret->free = free;
if (!memcmp (arch->buf+0x30, "\x00\x00\x00\x00\x20\x73\x74\x64\x6f\x75\x74\x20\x21\x55\x0c\xcd", 16)) {
if ((ptr = R_NEW (RBinAddr))) {
ptr->rva = ptr->offset = 0x9a;
r_list_append (ret, ptr);
}
}
return ret;
}
示例8: binsym
static RBinAddr* binsym(RBinArch *arch, int sym) {
ut64 addr;
RBinAddr *ret = NULL;
switch (sym) {
case R_BIN_SYM_MAIN:
addr = MACH0_(r_bin_mach0_get_main) (arch->bin_obj);
if (!addr || !(ret = R_NEW (RBinAddr)))
return NULL;
memset (ret, '\0', sizeof (RBinAddr));
ret->offset = ret->rva = addr;
break;
}
return ret;
}
示例9: R_NEW
R_API RAnalOp *r_anal_op_new() {
RAnalOp *op = R_NEW (RAnalOp);
if (op) {
memset (op, 0, sizeof (RAnalOp));
op->mnemonic = NULL;
op->addr = -1;
op->jump = -1;
op->fail = -1;
op->ref = -1;
op->value = -1;
op->next = NULL;
}
return op;
}
示例10: entries
static RList* entries(RBinArch *arch) {
RList *ret;
RBinAddr *ptr = NULL;
if (!(ret = r_list_new ()))
return NULL;
ret->free = free;
if (!(ptr = R_NEW (RBinAddr)))
return ret;
memset (ptr, '\0', sizeof (RBinAddr));
ptr->offset = ptr->rva = 0xffff0;
r_list_append (ret, ptr);
return ret;
}
示例11: r_strpool_new
R_API RStrpool* r_strpool_new (int sz) {
RStrpool *p = R_NEW (RStrpool);
if (!p) return NULL;
if (sz<1) sz = 1024;
p->size = sz;
p->len = 0;
p->str = malloc (sz);
if (!p->str) {
free (p);
return NULL;
}
p->str[0] = 0;
return p;
}
示例12: lines
static RList* lines(RBinArch *arch) {
int i;
char *file = strdup (arch->file);
RList *list = r_list_new ();
RBinJavaObj *b = arch->bin_obj;
file = r_str_replace (file, ".class", ".java", 0);
for (i=0; i<b->lines.count; i++) {
RBinDwarfRow *row = R_NEW (RBinDwarfRow);
r_bin_dwarf_line_new (row, b->lines.addr[i], file, b->lines.line[i]);
r_list_append (list, row);
}
free (file);
return list;
}
示例13: entries
static RList* entries(RBinFile *arch) {
RList* ret;
RBinAddr *ptr = NULL;
if (!(ret = r_list_new ()))
return NULL;
ret->free = free;
if ((ptr = R_NEW (RBinAddr))) {
ptr->paddr = 8*4;
ptr->vaddr = 8*4;// + baddr (arch);
r_list_append (ret, ptr);
}
return ret;
}
示例14: R_NEW
static RIODesc *w32__open(RIO *io, const char *pathname, int rw, int mode) {
if (!memcmp (pathname, "w32://", 6)) {
RIOW32 *w32 = R_NEW (RIOW32);
const char *filename= pathname+6;
w32->hnd = CreateFile (filename,
GENERIC_READ | rw?GENERIC_WRITE:0,
FILE_SHARE_READ | rw?FILE_SHARE_WRITE:0,
NULL, OPEN_ALWAYS, 0, NULL);
if (w32->hnd != INVALID_HANDLE_VALUE)
return r_io_desc_new (&r_io_plugin_w32, getw32fd (w32),
pathname, rw, mode, w32);
free (w32);
}
return NULL;
}
示例15: R_NEW
R_API RAnalBlock *r_anal_bb_new() {
RAnalBlock *bb = R_NEW (RAnalBlock);
if (!bb) return NULL;
memset (bb, 0, sizeof (RAnalBlock));
bb->addr = -1;
bb->jump = -1;
bb->fail = -1;
bb->type = R_ANAL_BB_TYPE_NULL;
#if R_ANAL_BB_HAS_OPS
bb->ops = r_anal_op_list_new ();
#endif
bb->cond = NULL;
bb->fingerprint = NULL;
bb->diff = r_anal_diff_new ();
return bb;
}