Purge symtab of make_cleanup_func.
authorAndrew Cagney <cagney@redhat.com>
Mon, 29 May 2000 13:18:15 +0000 (13:18 +0000)
committerAndrew Cagney <cagney@redhat.com>
Mon, 29 May 2000 13:18:15 +0000 (13:18 +0000)
Pass correct arg to make_cleanup_free_search_symbols.

gdb/ChangeLog
gdb/symtab.c
gdb/symtab.h

index 69124c0d31edda72ea53211b9a481bafc77ddf5d..112129bf92256ed4025664bfe9f4fd17f812c259 100644 (file)
@@ -1,3 +1,12 @@
+Mon May 29 15:41:10 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * symtab.h (make_cleanup_free_search_symbols): Add declaration.
+       * symtab.c (make_cleanup_free_search_symbols,
+       do_free_search_symbols_cleanup): New functions.
+       (search_symbols, symtab_symbol_info, rbreak_command): Update.
+       (search_symbols): Pass ``sr'', and not its address, to
+       make_cleanup_free_search_symbols.
+
 2000-05-28  Kevin Buettner  <kevinb@redhat.com>
 
        * config/nm-linux.h (GDB_GREGSET_T, GDB_FPREGSET_T): Fix typos.
index 4e1589603c061dc2a6ab383f2c55f892137a0936..41c23aa6b1438b7b711afe55aea2d4d95c72dc9a 100644 (file)
@@ -3564,6 +3564,19 @@ free_search_symbols (symbols)
     }
 }
 
+static void
+do_free_search_symbols_cleanup (void *symbols)
+{
+  free_search_symbols (symbols);
+}
+
+struct cleanup *
+make_cleanup_free_search_symbols (struct symbol_search *symbols)
+{
+  return make_cleanup (do_free_search_symbols_cleanup, symbols);
+}
+
+
 /* Search the symbol table for matches to the regular expression REGEXP,
    returning the results in *MATCHES.
 
@@ -3796,8 +3809,7 @@ search_symbols (regexp, kind, nfiles, files, matches)
                  if (tail == NULL)
                    {
                      sr = psr;
-                     old_chain = make_cleanup ((make_cleanup_func)
-                                               free_search_symbols, sr);
+                     old_chain = make_cleanup_free_search_symbols (sr);
                    }
                  else
                    tail->next = psr;
@@ -3841,8 +3853,7 @@ search_symbols (regexp, kind, nfiles, files, matches)
                        if (tail == NULL)
                          {
                            sr = psr;
-                           old_chain = make_cleanup ((make_cleanup_func)
-                                                 free_search_symbols, &sr);
+                           old_chain = make_cleanup_free_search_symbols (sr);
                          }
                        else
                          tail->next = psr;
@@ -3957,7 +3968,7 @@ symtab_symbol_info (regexp, kind, from_tty)
 
   /* must make sure that if we're interrupted, symbols gets freed */
   search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
-  old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
+  old_chain = make_cleanup_free_search_symbols (symbols);
 
   printf_filtered (regexp
                   ? "All %ss matching regular expression \"%s\":\n"
@@ -4045,7 +4056,7 @@ rbreak_command (regexp, from_tty)
   struct cleanup *old_chain;
 
   search_symbols (regexp, FUNCTIONS_NAMESPACE, 0, (char **) NULL, &ss);
-  old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, ss);
+  old_chain = make_cleanup_free_search_symbols (ss);
 
   for (p = ss; p != NULL; p = p->next)
     {
index 334d266a9f08aa4e6e7e24eb4f139608ae81d1b1..d846f3edfcad1dcb87d4786c207c5f68988b1d78 100644 (file)
@@ -1441,5 +1441,6 @@ struct symbol_search
 extern void search_symbols (char *, namespace_enum, int, char **,
                            struct symbol_search **);
 extern void free_search_symbols (struct symbol_search *);
+extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search *);
 
 #endif /* !defined(SYMTAB_H) */