gdb/testsuite: Fix race condition in gdb.base/skip.exp
[deliverable/binutils-gdb.git] / gdb / bcache.c
index 14a7847496226d5b9e4165226d1bd46dd373757c..49d9d3f486baca7e2476602a766cd461da5017a6 100644 (file)
@@ -2,7 +2,7 @@
    Written by Fred Fish <fnf@cygnus.com>
    Rewritten by Jim Blandy <jimb@cygnus.com>
 
-   Copyright (C) 1999-2019 Free Software Foundation, Inc.
+   Copyright (C) 1999-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "gdb_obstack.h"
 #include "bcache.h"
 
+#include <algorithm>
+
+namespace gdb {
+
 /* The type used to hold a single bcache string.  The user data is
    stored in d.data.  Since it can be any type, it needs to have the
    same alignment as the most strict alignment of any type on the host
@@ -49,31 +53,6 @@ struct bstring
   d;
 };
 
-/* The old hash function was stolen from SDBM. This is what DB 3.0
-   uses now, and is better than the old one.  */
-\f
-unsigned long
-hash(const void *addr, int length)
-{
-  return hash_continue (addr, length, 0);
-}
-
-/* Continue the calculation of the hash H at the given address.  */
-
-unsigned long
-hash_continue (const void *addr, int length, unsigned long h)
-{
-  const unsigned char *k, *e;
-
-  k = (const unsigned char *)addr;
-  e = k+length;
-  for (; k< e;++k)
-    {
-      h *=16777619;
-      h ^= *k;
-    }
-  return (h);
-}
 \f
 /* Growing the bcache's hash table.  */
 
@@ -311,10 +290,8 @@ bcache::print_statistics (const char *type)
 
     /* To compute the median, we need the set of chain lengths
        sorted.  */
-    qsort (chain_length, m_num_buckets, sizeof (chain_length[0]),
-          compare_positive_ints);
-    qsort (entry_size, m_unique_count, sizeof (entry_size[0]),
-          compare_positive_ints);
+    std::sort (chain_length, chain_length + m_num_buckets);
+    std::sort (entry_size, entry_size + m_unique_count);
 
     if (m_num_buckets > 0)
       {
@@ -403,3 +380,5 @@ bcache::memory_used ()
     return 0;
   return obstack_memory_used (&m_cache);
 }
+
+} /* namespace gdb */
This page took 0.035317 seconds and 4 git commands to generate.