From: David Brownell Date: Thu, 19 Nov 2009 21:23:49 +0000 (-0800) Subject: ARM: remove per-register malloc X-Git-Tag: v0.4.0-rc1~493 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8f446fcf676e9cd13cf53d9946f0cae5d29a10ec;p=openocd ARM: remove per-register malloc Just pre-allocate memory for the cached register value. Shrinks heap overhead; increases locality-of-reference. Signed-off-by: David Brownell --- diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index b6061af3..44e5b0ac 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -489,7 +489,7 @@ struct reg_cache* armv4_5_build_reg_cache(struct target *target, struct arm *arm reg_list[i].name = (char *) arm_core_regs[i].name; reg_list[i].size = 32; - reg_list[i].value = calloc(1, 4); + reg_list[i].value = &arch_info[i].value; reg_list[i].type = &arm_reg_type; reg_list[i].arch_info = &arch_info[i]; diff --git a/src/target/armv4_5.h b/src/target/armv4_5.h index 6b1dd769..50af57b3 100644 --- a/src/target/armv4_5.h +++ b/src/target/armv4_5.h @@ -143,6 +143,7 @@ struct armv4_5_core_reg enum armv4_5_mode mode; struct target *target; struct arm *armv4_5_common; + uint32_t value; }; struct reg_cache* armv4_5_build_reg_cache(struct target *target,