]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: move some stabs functions to gdbsupport/common-utils.h
authorGuinevere Larsen <guinevere@redhat.com>
Tue, 28 Jan 2025 18:45:10 +0000 (15:45 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Tue, 28 Jan 2025 19:23:50 +0000 (16:23 -0300)
The gdb/stabsread.h and .c files define 2 things that, while originally
intended only for stabs reading, actually end up being used for coff,
ecoff and maybe more debuginfo formats. That is the function "hashname",
and the macro HASHSIZE. Both are used for small hashtables when reading
some symbols with incomplete information.

With the upcoming removal of stabs code, this code should be moved
somewhere, and the only location that looked mildly reasonable was
gdbsupport/common-utils. No change is expected after this commit.

gdb/stabsread.c
gdb/stabsread.h
gdbsupport/common-utils.h

index e4798203fbbe4884a2067e01852393b0bd333633..485edd97609b968eb38b4f23532265a95f498226 100644 (file)
@@ -7188,14 +7188,6 @@ find_name_end (const char *name)
     }
 }
 
-/* See stabsread.h.  */
-
-int
-hashname (const char *name)
-{
-  return fast_hash (name, strlen (name)) % HASHSIZE;
-}
-
 /* Initializer for this module.  */
 
 void _initialize_stabsread ();
index a88b593b4436f94e423d2b324c0c11ec44189721..a54817da833d6664dbfd8c986051057b2ee0d092 100644 (file)
@@ -26,13 +26,6 @@ enum language;
 /* Definitions, prototypes, etc for stabs debugging format support
    functions.  */
 
-#define HASHSIZE 127           /* Size of things hashed via
-                                  hashname().  */
-
-/* Compute a small integer hash code for the given name.  */
-
-extern int hashname (const char *name);
-
 /* Count symbols as they are processed, for error messages.  */
 
 extern unsigned int symnum;
index 114342d845d8d76ce919e7c0518ab1251e7f2d5b..aaf08cbd576d6796d0c5cba35142f9f1909deee7 100644 (file)
@@ -240,6 +240,16 @@ fast_hash (const void *ptr, size_t len, unsigned int start_value = 0)
 #endif
 }
 
+/* Legacy hash for symbol names used for several debuginfo formats.  */
+
+#define HASHSIZE 127
+
+static inline int
+hashname (const char *name)
+{
+  return fast_hash (name, strlen (name)) % HASHSIZE;
+}
+
 namespace gdb
 {