From 37e2eea0d87e4e1bfd584e163bc97b88ac5a115b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 11 Jul 2009 00:15:39 +0000 Subject: [PATCH] Remove duplicates in the function list view. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31515 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/team_window/ImageFunctionsView.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/apps/debugger/gui/team_window/ImageFunctionsView.cpp b/src/apps/debugger/gui/team_window/ImageFunctionsView.cpp index 196f78d4ad..40bf126845 100644 --- a/src/apps/debugger/gui/team_window/ImageFunctionsView.cpp +++ b/src/apps/debugger/gui/team_window/ImageFunctionsView.cpp @@ -75,6 +75,23 @@ public: // sort them std::sort(functions, functions + functionCount, &_FunctionLess); + // eliminate duplicate function instances + if (functionCount > 0) { + Function* previousFunction = functions[0]->GetFunction(); + int32 removed = 0; + for (int32 i = 1; i < functionCount; i++) { + if (functions[i]->GetFunction() == previousFunction) { + removed++; + } else { + functions[i - removed] = functions[i]; + previousFunction = functions[i]->GetFunction(); + } + } + + functionCount -= removed; + // The array might now be too large, but we can live with that. + } + // count the different source files int32 sourceFileCount = 1; for (int32 i = 1; i < functionCount; i++) {