Get rid of _Bool

This commit is contained in:
pancake 2015-12-01 12:39:12 +01:00
parent bf54c766f3
commit 40e08dbd89
27 changed files with 62 additions and 88 deletions

View file

@ -362,7 +362,7 @@ R_API RAnalOp *r_anal_op_hexstr(RAnal *anal, ut64 addr, const char *str) {
return op;
}
R_API _Bool r_anal_op_is_eob (RAnalOp *op) {
R_API bool r_anal_op_is_eob (RAnalOp *op) {
switch (op->type) {
case R_ANAL_OP_TYPE_JMP:
case R_ANAL_OP_TYPE_UJMP:

View file

@ -885,7 +885,7 @@ static ut8 read_node_variant_mask (RFlirtNode *node, RBuffer *b) {
return true;
}
static _Bool read_node_bytes (RFlirtNode *node, RBuffer *b) {
static bool read_node_bytes (RFlirtNode *node, RBuffer *b) {
/*Reads the node bytes, and also sets the variant bytes in variant_bool_array*/
/*returns false on parsing error*/
int i;

View file

@ -29,7 +29,7 @@ R_API void r_sign_ns(RSign *sig, const char *str) {
} else sig->ns[0] = '\0';
}
R_API _Bool r_sign_add(RSign *sig, RAnal *anal, int type, const char *name, const char *arg) {
R_API bool r_sign_add(RSign *sig, RAnal *anal, int type, const char *name, const char *arg) {
int len;
char *data = NULL, *ptr;
RSignItem *si; // TODO: like in r_search.. we need r_sign_item_new ()

View file

@ -86,7 +86,7 @@ R_API const ut8 * r_anal_state_get_buf_by_addr (RAnalState *state, ut64 addr) {
return NULL;
}
R_API _Bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr) {
R_API bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr) {
return (addr < state->end && addr >= state->start);
}

View file

@ -136,7 +136,7 @@ enum lh5801_insn_format {
#define LH5801_IFMT_IMMS(f) ((f)&LH5801_IFMT_IMM_MASK)
#define LH5801_IFMT_RMODE(f) ((f)&LH5801_IFMT_RMODE_MASK)
static _Bool lh5801_ifmt_fd_matches(enum lh5801_insn_format fmt, int fd) {
static bool lh5801_ifmt_fd_matches(enum lh5801_insn_format fmt, int fd) {
switch (fmt & LH5801_IFMT_FD_MASK) {
case LH5801_IFMT_FD_NO: return !fd;
case LH5801_IFMT_FD_YES: return fd;

View file

@ -6,7 +6,7 @@
static csh handle = 0;
static _Bool the_end(void *p) {
static bool the_end(void *p) {
if (handle) {
cs_close (&handle);
handle = 0;
@ -59,10 +59,8 @@ RAsmPlugin r_asm_plugin_ppc_cs = {
.license = "BSD",
.arch = "ppc",
.bits = 32|64,
.init = NULL,
.fini = the_end,
.disassemble = &disassemble,
.assemble = NULL
};
#ifndef CORELIB

View file

@ -8,7 +8,7 @@
static csh cd = 0;
static _Bool the_end(void *p) {
static bool the_end(void *p) {
if (cd) {
cs_close (&cd);
cd = 0;
@ -57,10 +57,8 @@ RAsmPlugin r_asm_plugin_sysz = {
.license = "BSD",
.arch = "sysz",
.bits = 32,
.init = NULL,
.fini = the_end,
.disassemble = &disassemble,
.assemble = NULL
};
#ifndef CORELIB

View file

@ -28,11 +28,11 @@ static int tms320_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
return op->size;
}
static _Bool tms320_init(void * user) {
static bool tms320_init(void * user) {
return tms320_dasm_init (&engine);
}
static _Bool tms320_fini(void * user) {
static bool tms320_fini(void * user) {
return tms320_dasm_fini (&engine);
}

View file

@ -10,7 +10,7 @@ static csh cd = 0;
static int n = 0;
static cs_insn *insn = NULL;
static _Bool the_end(void *p) {
static bool the_end(void *p) {
#if !USE_ITER_API
if (insn) {
cs_free (insn, n);

View file

@ -294,7 +294,7 @@ R_API int r_bin_demangle_type (const char *str) {
return R_BIN_NM_NONE;
}
R_API int r_bin_lang_rust(RBinFile *binfile) {
R_API bool r_bin_lang_rust(RBinFile *binfile) {
RBinObject *o = binfile ? binfile->o : NULL;
RBinInfo *info = o ? o->info : NULL;
RBinSymbol *sym;

View file

@ -1,10 +1,10 @@
/* radare - LGPL - Copyright 2008-2014 pancake, inisider */
/* radare - LGPL - Copyright 2008-2015 pancake, inisider */
#include <r_util.h>
#include "coff.h"
_Bool r_coff_supported_arch (const ut8 *buf) {
bool r_coff_supported_arch (const ut8 *buf) {
ut16 arch = *(ut16*)buf;
switch (arch) {
case COFF_FILE_MACHINE_AMD64:

View file

@ -24,7 +24,7 @@ struct r_bin_coff_obj {
Sdb *kv;
};
_Bool r_coff_supported_arch(const ut8 *buf); /* Reads two bytes from buf. */
bool r_coff_supported_arch(const ut8 *buf); /* Reads two bytes from buf. */
struct r_bin_coff_obj* r_bin_coff_new_buf(struct r_buf_t *buf);
void r_bin_coff_free(struct r_bin_coff_obj *obj);
RBinAddr *r_coff_get_entry(struct r_bin_coff_obj *obj);

View file

@ -2,20 +2,20 @@
#include <r_bin.h>
static int is_cxx_symbol (const char *name) {
static bool is_cxx_symbol (const char *name) {
if (!strncmp (name, "_Z", 2))
return 1;
return true;
if (!strncmp (name, "__Z", 3))
return 1;
return 0;
return true;
return false;
}
R_API int r_bin_lang_cxx(RBinFile *binfile) {
R_API bool r_bin_lang_cxx(RBinFile *binfile) {
RBinObject *o = binfile ? binfile->o : NULL;
RBinInfo *info = o ? o->info : NULL;
RBinSymbol *sym;
RListIter *iter;
int hascxx = false;
bool hascxx = false;
const char *lib;
if (!info)

View file

@ -12,12 +12,12 @@ static int is_dlang_symbol (const char *name) {
return 0;
}
R_API int r_bin_lang_dlang(RBinFile *binfile) {
R_API bool r_bin_lang_dlang(RBinFile *binfile) {
RBinObject *o = binfile ? binfile->o : NULL;
RBinInfo *info = o ? o->info : NULL;
bool hasdlang = false;
RBinSymbol *sym;
RListIter *iter;
int hasdlang = false;
const char *lib;
if (!info)

View file

@ -2,18 +2,16 @@
#include <r_bin.h>
static int is_cxx_symbol (const char *name) {
if (*name == '?')
return 1;
return 0;
static bool is_cxx_symbol (const char *name) {
return (*name == '?');
}
R_API int r_bin_lang_msvc(RBinFile *binfile) {
R_API bool r_bin_lang_msvc(RBinFile *binfile) {
RBinObject *o = binfile ? binfile->o : NULL;
RBinInfo *info = o ? o->info : NULL;
RBinSymbol *sym;
RListIter *iter;
_Bool hascxx = false;
bool hascxx = false;
if (info) {
r_list_foreach (o->symbols, iter, sym) {
if (is_cxx_symbol (sym->name)) {
@ -24,5 +22,5 @@ R_API int r_bin_lang_msvc(RBinFile *binfile) {
if (hascxx)
info->lang = "msvc";
}
return (int)hascxx;
return hascxx;
}

View file

@ -1,26 +1,25 @@
/* radare - LGPL - Copyright 2012 - pancake */
/* radare - LGPL - Copyright 2012-2015 - pancake */
#include <r_bin.h>
R_API int r_bin_lang_objc(RBinFile *binfile) {
R_API bool r_bin_lang_objc(RBinFile *binfile) {
RBinObject *o = binfile ? binfile->o : NULL;
RBinInfo *info = o ? o->info : NULL;
RListIter *iter;
RBinSymbol *sym;
int hasobjc = false;
char *dsym;
bool hasobjc = false;
const char *ft;
char *dsym;
if (!info)
return 0;
if (!info) return false;
ft = info->rclass;
if (!ft || (!strstr (ft, "mach") && !strstr (ft, "elf")))
return 0;
return false;
r_list_foreach (o->symbols, iter, sym) {
if (!hasobjc)
if (!strncmp (sym->name, "_OBJC_", 6))
hasobjc = true;
if (!hasobjc && !strncmp (sym->name, "_OBJC_", 6)) {
hasobjc = true;
break;
}
dsym = r_bin_demangle_objc (binfile, sym->name);
if (dsym) {
// Add type

View file

@ -2,21 +2,18 @@
#include <r_bin.h>
R_API int r_bin_lang_swift(RBinFile *binfile) {
R_API bool r_bin_lang_swift(RBinFile *binfile) {
RBinObject *o = binfile ? binfile->o : NULL;
RBinInfo *info = o ? o->info : NULL;
RBinSymbol *sym;
RListIter *iter;
_Bool haslang = false;
if (info) {
r_list_foreach (o->symbols, iter, sym) {
if (strstr (sym->name, "swift_release")) {
haslang = true;
info->lang = "swift";
break;
return true;
}
}
}
return (int)haslang;
return false;
}

View file

@ -287,7 +287,7 @@ R_API int r_core_yank_cat (RCore *core, ut64 pos) {
R_API int r_core_yank_hud_file (RCore *core, const char *input) {
char *buf = NULL;
_Bool res = false;
bool res = false;
ut32 len = 0;
if (!input || !*input) return false;
for (input++; *input==' '; input++) ;

View file

@ -804,7 +804,7 @@ R_API int r_debug_continue_syscall(RDebug *dbg, int sc) {
// TODO: remove from here? this is code injection!
R_API int r_debug_syscall(RDebug *dbg, int num) {
_Bool ret = false;
bool ret = false;
if (dbg->h->contsc) {
ret = dbg->h->contsc (dbg, dbg->pid, num);
} else {

View file

@ -755,9 +755,9 @@ static RList *r_debug_native_map_get (RDebug *dbg) {
#if __KFBSD__
list = r_debug_native_sysctl_map (dbg);
if (list != NULL) return list;
snprintf (path, sizeof(path), "/proc/%d/map", dbg->pid);
snprintf (path, sizeof (path), "/proc/%d/map", dbg->pid);
#else
snprintf (path, sizeof(path), "/proc/%d/maps", dbg->pid);
snprintf (path, sizeof (path), "/proc/%d/maps", dbg->pid);
#endif
fd = fopen (path, "r");
if (!fd) {
@ -813,7 +813,7 @@ static RList *r_debug_native_map_get (RDebug *dbg) {
r_num_get (NULL, region),
r_num_get (NULL, region2),
perm, 0);
if (map == NULL) break;
if (!map) break;
map->file = strdup (path);
r_list_append (list, map);
}
@ -878,23 +878,6 @@ static RList *r_debug_native_modules_get (RDebug *dbg) {
return last;
}
// TODO: deprecate???
#if 0
static int r_debug_native_bp_write(int pid, ut64 addr, int size, int hw, int rwx) {
if (hw) {
/* implement DRx register handling here */
return true;
}
return false;
}
/* TODO: rethink */
static int r_debug_native_bp_read(int pid, ut64 addr, int hw, int rwx) {
return true;
}
#endif
// TODO: implement own-defined signals
static int r_debug_native_kill (RDebug *dbg, int pid, int tid, int sig) {
int ret = false;
if (pid == 0) pid = dbg->pid;
@ -1075,6 +1058,7 @@ static RList *xnu_desc_list (int pid) {
#endif
}
#endif
#if __WINDOWS__
static RList *win_desc_list (int pid) {
RDebugDesc *desc;

View file

@ -1176,7 +1176,7 @@ R_API const char *r_anal_stackop_tostring (int s);
R_API RAnalOp *r_anal_op_new(void);
R_API void r_anal_op_free(void *op);
R_API void r_anal_op_fini(RAnalOp *op);
R_API _Bool r_anal_op_is_eob (RAnalOp *op);
R_API bool r_anal_op_is_eob (RAnalOp *op);
R_API RList *r_anal_op_list_new(void);
R_API int r_anal_op(RAnal *anal, RAnalOp *op, ut64 addr,
const ut8 *data, int len);
@ -1188,7 +1188,7 @@ R_API RAnalEsil *r_anal_esil_new (int iotrap);
R_API void r_anal_esil_trace (RAnalEsil *esil, RAnalOp *op);
R_API void r_anal_esil_trace_list (RAnalEsil *esil);
R_API void r_anal_esil_trace_show (RAnalEsil *esil, int idx);
R_API _Bool r_anal_esil_set_pc (RAnalEsil *esil, ut64 addr);
R_API bool r_anal_esil_set_pc (RAnalEsil *esil, ut64 addr);
R_API int r_anal_esil_setup (RAnalEsil *esil, RAnal *anal, int romem, int stats);
R_API void r_anal_esil_free (RAnalEsil *esil);
R_API int r_anal_esil_parse (RAnalEsil *esil, const char *str);
@ -1198,7 +1198,7 @@ R_API int r_anal_esil_mem_write (RAnalEsil *esil, ut64 addr, const ut8 *buf, int
R_API int r_anal_esil_reg_read (RAnalEsil *esil, const char *regname, ut64 *num, int *size);
R_API int r_anal_esil_reg_write (RAnalEsil *esil, const char *dst, ut64 num);
R_API int r_anal_esil_pushnum (RAnalEsil *esil, ut64 num);
R_API _Bool r_anal_esil_push (RAnalEsil *esil, const char *str);
R_API bool r_anal_esil_push (RAnalEsil *esil, const char *str);
R_API char *r_anal_esil_pop (RAnalEsil *esil);
R_API int r_anal_esil_set_op (RAnalEsil *esil, const char *op, RAnalEsilOp code);
R_API void r_anal_esil_stack_free (RAnalEsil *esil);
@ -1476,7 +1476,7 @@ R_API RAnalBlock * r_anal_state_search_bb (RAnalState* state, ut64 addr);
R_API void r_anal_state_free (RAnalState * state);
R_API ut64 r_anal_state_get_len (RAnalState *state, ut64 addr);
R_API const ut8 * r_anal_state_get_buf_by_addr (RAnalState *state, ut64 addr);
R_API _Bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr);
R_API bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr);
R_API void r_anal_state_merge_bb_list (RAnalState *state, RList* bbs);
R_API void r_anal_state_set_depth(RAnalState *state, ut32 depth);

View file

@ -116,8 +116,8 @@ typedef struct r_asm_plugin_t {
char *license;
void *user; // user data pointer
int bits;
_Bool (*init)(void *user);
_Bool (*fini)(void *user);
bool (*init)(void *user);
bool (*fini)(void *user);
int (*disassemble)(RAsm *a, RAsmOp *op, const ut8 *buf, int len);
int (*assemble)(RAsm *a, RAsmOp *op, const char *buf);
RAsmModifyCallback modify;

View file

@ -434,12 +434,12 @@ R_API char *r_bin_demangle_msvc(const char *str);
R_API char *r_bin_demangle_swift(const char *s);
R_API char *r_bin_demangle_objc(RBinFile *binfile, const char *sym);
R_API int r_bin_lang_type(RBinFile *binfile, const char *def, const char *sym);
R_API int r_bin_lang_objc(RBinFile *binfile);
R_API int r_bin_lang_swift(RBinFile *binfile);
R_API int r_bin_lang_cxx(RBinFile *binfile);
R_API int r_bin_lang_msvc(RBinFile *binfile);
R_API int r_bin_lang_dlang(RBinFile *binfile);
R_API int r_bin_lang_rust(RBinFile *binfile);
R_API bool r_bin_lang_objc(RBinFile *binfile);
R_API bool r_bin_lang_swift(RBinFile *binfile);
R_API bool r_bin_lang_cxx(RBinFile *binfile);
R_API bool r_bin_lang_msvc(RBinFile *binfile);
R_API bool r_bin_lang_dlang(RBinFile *binfile);
R_API bool r_bin_lang_rust(RBinFile *binfile);
R_API RList* r_bin_get_entries(RBin *bin);
R_API RList* r_bin_get_fields(RBin *bin);

View file

@ -353,7 +353,7 @@ R_API int r_io_cache_read(RIO *io, ut64 addr, ut8 *buf, int len);
/* io/map.c */
R_API void r_io_map_init(RIO *io);
R_API _Bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map);
R_API bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map);
R_API ut64 r_io_map_next(RIO *io, ut64 addr);
R_API RIOMap *r_io_map_add(RIO *io, int fd, int flags, ut64 delta, ut64 offset, ut64 size);
R_API int r_io_map_del_at(RIO *io, ut64 addr);

View file

@ -44,7 +44,7 @@ typedef int (*RSignCallback)(RSignItem *si, void *user);
#ifdef R_API
R_API RSign *r_sign_new(void);
R_API _Bool r_sign_add(RSign *sig, RAnal *anal, int type,
R_API bool r_sign_add(RSign *sig, RAnal *anal, int type,
const char *name, const char *arg);
R_API RSign *r_sign_free(RSign *sig);
R_API void r_sign_ns(RSign *sig, const char *str);

View file

@ -314,7 +314,7 @@ R_API ut64 r_io_map_select_current_fd(RIO *io, ut64 off, int fd) {
return paddr;
}
R_API _Bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map) {
R_API bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map) {
RListIter *iter;
RIOMap *im = NULL;
ut64 off = map->from;

View file

@ -11,7 +11,7 @@ CS_VER=3.0
CS_TAR=http://capstone-engine.org/download/$(CS_VER)/capstone-$(CS_VER).tgz
CS_TAR=
CS_URL=$(GIT_PREFIX)github.com/aquynh/capstone.git
CS_UPD=20151128
CS_UPD=20151201
CS_BRA=next
CS_TIP=7fc5bc3b4bed4f852124ec1af6a97985118c75b8
# REVERT THIS COMMIT BECAUSE ITS WRONG