]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-11-15 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sat, 15 Nov 2003 19:39:04 +0000 (19:39 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 15 Nov 2003 19:39:04 +0000 (19:39 +0000)
* bcache.h (deprecated_bcache): Declare.
(bcache): Make returned buffer constant.
* bcache.c (deprecated_bcache): New function.
(bcache_data): New function.
(bcache): Call bcache data.
* symfile.c (add_psymbol_to_list): Use deprecated_bcache.
(add_psymbol_with_dem_name_to_list): Ditto.

gdb/ChangeLog
gdb/bcache.c
gdb/bcache.h
gdb/symfile.c

index 3c59bc5be188d6ddeb265044d08cdbed4c29d419..984dbaf4de742daab69e18fdc1d81419aad90dd8 100644 (file)
@@ -1,3 +1,13 @@
+2003-11-15  Andrew Cagney  <cagney@redhat.com>
+
+       * bcache.h (deprecated_bcache): Declare.
+       (bcache): Make returned buffer constant.
+       * bcache.c (deprecated_bcache): New function.
+       (bcache_data): New function.
+       (bcache): Call bcache data.
+       * symfile.c (add_psymbol_to_list): Use deprecated_bcache.
+       (add_psymbol_with_dem_name_to_list): Ditto.
+
 2003-11-15  Mark Kettenis  <kettenis@gnu.org>
 
        * glibc-tdep.h (struct gdbarch): Declare opaque.
index ec8b777acd669e5217ae91a3c3158f9752209af5..b1d9de8700fac3dfd1a3afd91fc2a7223770ae72 100644 (file)
@@ -195,8 +195,8 @@ expand_hash_table (struct bcache *bcache)
 /* Find a copy of the LENGTH bytes at ADDR in BCACHE.  If BCACHE has
    never seen those bytes before, add a copy of them to BCACHE.  In
    either case, return a pointer to BCACHE's copy of that string.  */
-void *
-bcache (const void *addr, int length, struct bcache *bcache)
+static void *
+bcache_data (const void *addr, int length, struct bcache *bcache)
 {
   unsigned long full_hash;
   unsigned short half_hash;
@@ -247,6 +247,17 @@ bcache (const void *addr, int length, struct bcache *bcache)
   }
 }
 
+void *
+deprecated_bcache (const void *addr, int length, struct bcache *bcache)
+{
+  return bcache_data (addr, length, bcache);
+}
+
+const void *
+bcache (const void *addr, int length, struct bcache *bcache)
+{
+  return bcache_data (addr, length, bcache);
+}
 \f
 /* Allocating and freeing bcaches.  */
 
index 6c3a63d2ba882ff4814b66cbb077323f3da78b12..bf69853f21d82d3067f2a85461c2f5fef6d5bd80 100644 (file)
@@ -143,8 +143,13 @@ struct bcache;
 
 /* Find a copy of the LENGTH bytes at ADDR in BCACHE.  If BCACHE has
    never seen those bytes before, add a copy of them to BCACHE.  In
-   either case, return a pointer to BCACHE's copy of that string.  */
-extern void *bcache (const void *addr, int length, struct bcache *bcache);
+   either case, return a pointer to BCACHE's copy of that string.
+   Since the cached value is ment to be read-only, return a const
+   buffer.  */
+extern void *deprecated_bcache (const void *addr, int length,
+                               struct bcache *bcache);
+extern const void *bcache (const void *addr, int length,
+                          struct bcache *bcache);
 
 /* Free all the storage used by BCACHE.  */
 extern void bcache_xfree (struct bcache *bcache);
index 6e51f982d57dc62b3dcfdb579fa69b9504f0c0d7..d85ec19128eb936729df5f227a54a0b2944e33dd 100644 (file)
@@ -2680,7 +2680,8 @@ add_psymbol_to_list (char *name, int namelength, domain_enum domain,
   SYMBOL_SET_NAMES (&psymbol, buf, namelength, objfile);
 
   /* Stash the partial symbol away in the cache */
-  psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache);
+  psym = deprecated_bcache (&psymbol, sizeof (struct partial_symbol),
+                           objfile->psymbol_cache);
 
   /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
   if (list->next >= list->list + list->size)
@@ -2717,7 +2718,8 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
 
   memcpy (buf, name, namelength);
   buf[namelength] = '\0';
-  DEPRECATED_SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache);
+  DEPRECATED_SYMBOL_NAME (&psymbol) = deprecated_bcache (buf, namelength + 1,
+                                                        objfile->psymbol_cache);
 
   buf = alloca (dem_namelength + 1);
   memcpy (buf, dem_name, dem_namelength);
@@ -2728,7 +2730,7 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
     case language_c:
     case language_cplus:
       SYMBOL_CPLUS_DEMANGLED_NAME (&psymbol) =
-       bcache (buf, dem_namelength + 1, objfile->psymbol_cache);
+       deprecated_bcache (buf, dem_namelength + 1, objfile->psymbol_cache);
       break;
       /* FIXME What should be done for the default case? Ignoring for now. */
     }
@@ -2749,7 +2751,8 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
   SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
 
   /* Stash the partial symbol away in the cache */
-  psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache);
+  psym = deprecated_bcache (&psymbol, sizeof (struct partial_symbol),
+                           objfile->psymbol_cache);
 
   /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
   if (list->next >= list->list + list->size)