Commit 438580ab authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Use simple assignment instead of memcpy() when possible.

parent 37d7ef61
......@@ -162,7 +162,7 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
static arch_env_t *TEMPLATE_init(FILE *outfile)
{
TEMPLATE_isa_t *isa = XMALLOC(TEMPLATE_isa_t);
memcpy(isa, &TEMPLATE_isa_template, sizeof(*isa));
*isa = TEMPLATE_isa_template;
be_emit_init(outfile);
......
......@@ -309,7 +309,7 @@ static amd64_isa_t amd64_isa_template = {
static arch_env_t *amd64_init(FILE *outfile)
{
amd64_isa_t *isa = XMALLOC(amd64_isa_t);
memcpy(isa, &amd64_isa_template, sizeof(*isa));
*isa = amd64_isa_template;
be_emit_init(outfile);
......
......@@ -443,7 +443,7 @@ static arm_isa_t arm_isa_template = {
static arch_env_t *arm_init(FILE *file_handle)
{
arm_isa_t *isa = XMALLOC(arm_isa_t);
memcpy(isa, &arm_isa_template, sizeof(*isa));
*isa = arm_isa_template;
arm_register_init();
......
......@@ -414,7 +414,7 @@ static void be_ra_chordal_main(ir_graph *irg)
be_do_stat_reg_pressure(irg, cls);
}
memcpy(&pse.cenv, &chordal_env, sizeof(chordal_env));
pse.cenv = chordal_env;
pse.irg = irg;
pre_spill(&pse, cls);
......
......@@ -1507,7 +1507,7 @@ static arch_env_t *ia32_init(FILE *file_handle)
set_tarval_output_modes();
memcpy(isa, &ia32_isa_template, sizeof(*isa));
*isa = ia32_isa_template;
if (ia32_mode_fpcw == NULL) {
ia32_mode_fpcw = new_ir_mode("Fpcw", irms_int_number, 16, 0, irma_none, 0);
......
......@@ -484,7 +484,7 @@ static void sparc_handle_intrinsics(void)
static arch_env_t *sparc_init(FILE *outfile)
{
sparc_isa_t *isa = XMALLOC(sparc_isa_t);
memcpy(isa, &sparc_isa_template, sizeof(*isa));
*isa = sparc_isa_template;
isa->constants = pmap_create();
be_emit_init(outfile);
......
......@@ -218,7 +218,7 @@ int ir_timer_enter_high_priority(void)
algo = sched_getscheduler(pid);
max = sched_get_priority_max(algo);
memcpy(&p, &std_sched_param, sizeof(p));
p = std_sched_param;
p.sched_priority = max;
res = sched_setparam(pid, &p);
......
......@@ -166,7 +166,7 @@ ir_op *new_ir_op(unsigned code, const char *name, op_pin_state p,
res->tag = 0;
if (ops)
memcpy(&res->ops, ops, sizeof(res->ops));
res->ops = *ops;
else /* no given ops, set all operations to NULL */
memset(&res->ops, 0, sizeof(res->ops));
......
......@@ -1305,8 +1305,7 @@ static void update_graph_stat_2(graph_entry_t *global, graph_entry_t *graph)
static void stat_register_dumper(const dumper_t *dumper)
{
dumper_t *p = XMALLOC(dumper_t);
memcpy(p, dumper, sizeof(*p));
*p = *dumper;
p->next = status->dumper;
p->status = status;
......
......@@ -807,7 +807,7 @@ static HASH_MAP(pattern_entry_t) *read_pattern(const char *fname)
for (j = 0; j < tmp.len; ++j)
put_byte(&buf, fgetc(f));
entry = pattern_get_entry(&buf, pattern_hash);
memcpy(&entry->count, &tmp.count, sizeof(entry->count));
entry->count = tmp.count;
} /* for */
fclose(f);
......
......@@ -385,7 +385,7 @@ pattern_dumper_t *new_text_dumper(void)
{
pattern_dumper_t *res = XMALLOC(pattern_dumper_t);
memcpy(res, &stdout_dump, sizeof(*res));
*res = stdout_dump;
res->data = stdout;
if (res->dump_start)
......
......@@ -52,7 +52,7 @@ new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size, const tp
res->attr_size = attr_size;
if (ops)
memcpy(&res->ops, ops, sizeof(res->ops));
res->ops = *ops;
else
memset(&res->ops, 0, sizeof(res->ops));
......
......@@ -199,7 +199,7 @@ static int normalize(const fp_value *in_val, fp_value *out_val, int sticky)
if (in_val != out_val) {
out_val->sign = in_val->sign;
memcpy(&out_val->desc, &in_val->desc, sizeof(out_val->desc));
out_val->desc = in_val->desc;
}
out_val->desc.clss = NORMAL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment