From fa9b0e2167c295c1f0de349563b893540fc73cb0 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 22 Nov 2009 15:50:24 -0800 Subject: ARM11: macro cleanup Make this code look more like the rest of the OpenOCD code. - Use calloc() directly, not NEW() ... and fix some potential memory leaks while we're at it. - Remove FNC_INFO ... it's a NOP that just clutters things, and it's trivial for developers to add tracing as needed. - Replace FNC_INFO_NOTIMPLEMENTED with LOG_WARNING calls; ditto. And stop having those call sites wrongly succeed! - Waste less space with the CHECK_RETVAL() macro. Signed-off-by: David Brownell --- src/target/arm11.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/target/arm11.h') diff --git a/src/target/arm11.h b/src/target/arm11.h index 0b379294..3d7841d5 100644 --- a/src/target/arm11.h +++ b/src/target/arm11.h @@ -25,27 +25,20 @@ #include "armv4_5.h" -#define NEW(type, variable, items) \ - type * variable = calloc(1, sizeof(type) * items) - /* TEMPORARY -- till we switch to the shared infrastructure */ #define ARM11_REGCACHE_COUNT 20 #define ARM11_TAP_DEFAULT TAP_INVALID - -#define CHECK_RETVAL(action) \ -do { \ - int __retval = (action); \ - \ - if (__retval != ERROR_OK) \ - { \ - LOG_DEBUG("error while calling \"" # action "\""); \ - return __retval; \ - } \ - \ -} while (0) - +#define CHECK_RETVAL(action) \ + do { \ + int __retval = (action); \ + if (__retval != ERROR_OK) { \ + LOG_DEBUG("error while calling \"%s\"", \ + # action ); \ + return __retval; \ + } \ + } while (0) struct arm11_register_history { -- cgit v1.2.3