]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gprofng: fix sorting in Hist_data::sort
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Tue, 10 Dec 2024 02:33:48 +0000 (18:33 -0800)
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Tue, 10 Dec 2024 20:46:47 +0000 (12:46 -0800)
If the '-name soname' option is used, the fake '<Total>' function is expanded
with the name loadobject.

gprofng/ChangeLog
2024-12-09  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

* src/Hist_data.cc (Hist_data::sort): Fix sorting.

gprofng/src/Hist_data.cc

index fb729018e0a3f2cdae046b47b5ff69dade3ef25a..35d1f866a829e6dabb2bc32eb7fb4c6d7ec5a67f 100644 (file)
@@ -521,12 +521,11 @@ Hist_data::sort (long ind, bool reverse)
     hist_items->sort ((CompareFunc) sort_compare_all, this);
 
   // ensure that <Total> comes first/last
-  char *tname = NTXT ("<Total>");
   for (int i = 0; i < hist_items->size (); ++i)
     {
       HistItem *hi = hist_items->fetch (i);
       char *name = hi->obj->get_name ();
-      if (name != NULL && streq (name, tname))
+      if (name != NULL && strncmp (name, "<Total>", 7) == 0)
        {
          int idx0 = rev_sort ? hist_items->size () - 1 : 0;
          if (i != idx0)