[PATCH 4/6] When checking for duplicate symbol names, the last symbol was always removed with other duplicates |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- Subject: [PATCH 4/6] When checking for duplicate symbol names, the last symbol was always removed with other duplicates
- From: Thorsten Otto <admin@xxxxxxxxxxx>
- Date: Mon, 25 Jul 2022 14:28:09 +0200
---
src/debug/symbols.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/debug/symbols.c b/src/debug/symbols.c
index 3177fdb3..7aa6e93d 100644
--- a/src/debug/symbols.c
+++ b/src/debug/symbols.c
@@ -185,7 +185,7 @@ static void symbols_trim_names(symbol_list_t* list)
int i, next, count, dups;
count = list->namecount;
- for (dups = i = 0; i < count - 1; i++) {
+ for (dups = i = 0; i < count - 1; ) {
next = i + 1;
if (strcmp(sym[i].name, sym[next].name) == 0 &&
sym[i].address == sym[next].address &&
@@ -194,12 +194,14 @@ static void symbols_trim_names(symbol_list_t* list)
memmove(sym+i, sym+next, (count-next) * sizeof(symbol_t));
count--;
dups++;
+ } else {
+ i++;
}
}
if (dups || list->namecount < list->symbols) {
- list->names = realloc(list->names, i * sizeof(symbol_t));
+ list->names = realloc(list->names, count * sizeof(symbol_t));
assert(list->names);
- list->namecount = i;
+ list->namecount = count;
}
if (dups) {
fprintf(stderr, "WARNING: removed %d complete symbol duplicates\n", dups);
--
2.24.0
--nextPart47411014.jKvtMvv4xN
Content-Disposition: attachment; filename="0006-Adjust-statusbar-when-linux-or-netbsd-are-loaded.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0006-Adjust-statusbar-when-linux-or-netbsd-are-loaded.patch"