X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firreflect.c;h=72ae101b7acc37abbbcb4b8e49bb232f29504439;hb=76a6c3b40390427bc516a943316642bb57daa465;hp=ad211f6a3e78529bcff5c09d7a06a2c11b1af2aa;hpb=eda212f88988120cf090de003feaaf4898200008;p=libfirm diff --git a/ir/ir/irreflect.c b/ir/ir/irreflect.c index ad211f6a3..72ae101b7 100644 --- a/ir/ir/irreflect.c +++ b/ir/ir/irreflect.c @@ -6,14 +6,21 @@ * * $Id$ */ - -#include -#include -#include - -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif + +#include "obst.h" #include "irmode.h" #include "irreflect.h" @@ -59,7 +66,7 @@ typedef struct { const char *name; bool commutative; int sig_count; - const rflct_arg_t *sigs[MAX_SIG_COUNT]; + rflct_arg_t *sigs[MAX_SIG_COUNT]; } rflct_opcode_t; static struct obstack obst; @@ -72,9 +79,7 @@ static INLINE void assure_opcode_capacity(int opcode) { if(opcode >= opcodes_size) { int new_size = 2 * opcode; - rflct_opcode_t **new_opcodes = malloc(sizeof(*new_opcodes) * new_size); - - memset(new_opcodes, 0, sizeof(*new_opcodes) * new_size); + rflct_opcode_t **new_opcodes = xcalloc(new_size, sizeof(new_opcodes[0])); if(opcodes != NULL) { memcpy(new_opcodes, opcodes, sizeof(*opcodes) * opcodes_size); @@ -408,7 +413,7 @@ void rflct_new_opcode(opcode opc, const char *name, bool commutative) bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig) { - const rflct_arg_t *args = sig->args; + rflct_arg_t *args = sig->args; rflct_opcode_t *op = opcodes[opc]; int i; @@ -428,7 +433,7 @@ bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig) rflct_sig_t *rflct_signature_allocate(int defs, int uses) { - rflct_sig_t *sig = malloc(sizeof(*sig)); + rflct_sig_t *sig = xmalloc(sizeof(*sig)); rflct_arg_t *args = obstack_alloc(&obst, sizeof(*args) * (defs + uses + 2)); @@ -468,6 +473,6 @@ int rflct_signature_set_arg(rflct_sig_t *sig, bool is_use, int num, } -void init_rflct(void) { +void firm_init_rflct(void) { init_ops(); }