summaryrefslogtreecommitdiff
path: root/src/format/symbol.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-01-06 04:12:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-01-06 04:12:24 (GMT)
commit6db53b26e6c3d973295df51bb1934d5b42fb6ebe (patch)
tree401358c8b10a879daa23336d06d7f14f273ee764 /src/format/symbol.h
parent73308548c2be7f6480f3c898ceb6d01ae4e3f64c (diff)
Checked if a symbol exists right before adding it to the symbol list.
Diffstat (limited to 'src/format/symbol.h')
-rw-r--r--src/format/symbol.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/format/symbol.h b/src/format/symbol.h
index 67696f4..4a48cf8 100644
--- a/src/format/symbol.h
+++ b/src/format/symbol.h
@@ -144,8 +144,8 @@ GDbComment *g_binary_symbol_get_comment(const GBinSymbol *);
while (0)
#define ADD_RAW_AS_SYM(_fmt, _sym, _ins, _cmt, _txt) \
- do \
- { \
+ ({ \
+ bool __result; \
const vmpa2t *__addr; \
__addr = get_mrange_addr(g_arch_instruction_get_range(_ins)); \
_cmt = g_db_comment_new_inlined(__addr, BLF_HAS_CODE, _txt, false); \
@@ -153,18 +153,18 @@ GDbComment *g_binary_symbol_get_comment(const GBinSymbol *);
_sym = g_binary_symbol_new(STP_DATA); \
g_binary_symbol_attach_instruction(_sym, _ins); \
g_binary_symbol_set_comment(_sym, _cmt); \
- g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \
- } \
- while (0)
-
-#define ADD_STR_AS_SYM(_fmt, _sym, _ins) \
- do \
- { \
- _sym = g_binary_symbol_new(STP_RO_STRING); \
- g_binary_symbol_attach_instruction(_sym, _ins); \
- g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \
- } \
- while (0)
+ __result = g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \
+ __result; \
+ })
+
+#define ADD_STR_AS_SYM(_fmt, _sym, _ins) \
+ ({ \
+ bool __result; \
+ _sym = g_binary_symbol_new(STP_RO_STRING); \
+ g_binary_symbol_attach_instruction(_sym, _ins); \
+ __result = g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \
+ __result; \
+ })