2011-05-27 Pedro Alves <pedro@codesourcery.com>
authorPedro Alves <palves@redhat.com>
Fri, 27 May 2011 14:56:14 +0000 (14:56 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 27 May 2011 14:56:14 +0000 (14:56 +0000)
gdb/
* defs.h (continuation_ftype, continuation_free_arg_ftype): New
typedefs.
(add_continuation, add_intermediate_continuation)
(add_inferior_continuation): Use them.
* continuations.c (struct continuation): Use them.
(make_continuation_ftype): Delete.
(make_continuation, add_inferior_continuation, add_continuation)
(add_intermediate_continuation): Use continuation_ftype and
continuation_free_arg_ftype.  Rename parameters to shorter names.

gdb/ChangeLog
gdb/continuations.c
gdb/defs.h

index 39a889a28a9e111f3258cba7c13c5cb9a5349137..2e6f3ffddd3268e31e404c1830592c8e2019df5d 100644 (file)
@@ -1,3 +1,15 @@
+2011-05-27  Pedro Alves  <pedro@codesourcery.com>
+
+       * defs.h (continuation_ftype, continuation_free_arg_ftype): New
+       typedefs.
+       (add_continuation, add_intermediate_continuation)
+       (add_inferior_continuation): Use them.
+       * continuations.c (struct continuation): Use them.
+       (make_continuation_ftype): Delete.
+       (make_continuation, add_inferior_continuation, add_continuation)
+       (add_intermediate_continuation): Use continuation_ftype and
+       continuation_free_arg_ftype.  Rename parameters to shorter names.
+
 2011-05-27  Pedro Alves  <pedro@codesourcery.com>
 
        * continuations.c (make_continuation): Make it return void.
index 2601a2347c4a79856ad8a2578a895c696ebca0e7..1f5c8a466ae57cd08c9d48a35c3c041af0de110d 100644 (file)
 struct continuation
 {
   struct continuation *next;
-  void (*function) (void *);
-  void (*free_arg) (void *);
+  continuation_ftype *function;
+  continuation_free_arg_ftype *free_arg;
   void *arg;
 };
 
-typedef void (make_continuation_ftype) (void *);
-
 /* Add a new continuation to the continuation chain.  Args are
    FUNCTION to run the continuation up with, and ARG to pass to
    it.  */
 
 static void
 make_continuation (struct continuation **pmy_chain,
-                  make_continuation_ftype *function,
+                  continuation_ftype *function,
                   void *arg,  void (*free_arg) (void *))
 {
   struct continuation *new = XNEW (struct continuation);
@@ -113,13 +111,12 @@ discard_my_continuations (struct continuation **list)
    continuation will be added at the front.  */
 
 void
-add_inferior_continuation (void (*continuation_hook) (void *), void *args,
-                          void (*continuation_free_args) (void *))
+add_inferior_continuation (continuation_ftype *hook, void *args,
+                          continuation_free_arg_ftype *free_arg)
 {
   struct inferior *inf = current_inferior ();
 
-  make_continuation (&inf->continuations, continuation_hook,
-                    args, continuation_free_args);
+  make_continuation (&inf->continuations, hook, args, free_arg);
 }
 
 /* Do all continuations of the current inferior.  */
@@ -144,11 +141,10 @@ discard_all_inferior_continuations (struct inferior *inf)
 
 void
 add_continuation (struct thread_info *thread,
-                 void (*continuation_hook) (void *), void *args,
-                 void (*continuation_free_args) (void *))
+                 continuation_ftype *hook, void *args,
+                 continuation_free_arg_ftype *free_arg)
 {
-  make_continuation (&thread->continuations, continuation_hook,
-                    args, continuation_free_args);
+  make_continuation (&thread->continuations, hook, args, free_arg);
 }
 
 static void
@@ -256,12 +252,12 @@ discard_all_continuations (void)
 
 void
 add_intermediate_continuation (struct thread_info *thread,
-                              void (*continuation_hook)
-                              (void *), void *args,
-                              void (*continuation_free_args) (void *))
+                              continuation_ftype *hook,
+                              void *args,
+                              continuation_free_arg_ftype *free_arg)
 {
-  make_continuation (&thread->intermediate_continuations, continuation_hook,
-                    args, continuation_free_args);
+  make_continuation (&thread->intermediate_continuations, hook,
+                    args, free_arg);
 }
 
 /* Walk down the cmd_continuation list, and execute all the
index 38a2fcf98c0b058d6fbb1101e18d4709c5bfd931..7deee6927ac5dab8814a6677b098df7f0f0ec849 100644 (file)
@@ -740,21 +740,29 @@ struct continuation;
 struct thread_info;
 struct inferior;
 
-/* From utils.c */
+/* From continuations.c */
+
+/* Prototype of the continuation callback functions.  */
+typedef void (continuation_ftype) (void *);
+
+/* Prototype of the function responsible for releasing the argument
+   passed to the continuation callback functions, either when the
+   continuation is called, or discarded.  */
+typedef void (continuation_free_arg_ftype) (void *);
 
 /* Thread specific continuations.  */
 
 extern void add_continuation (struct thread_info *,
-                             void (*)(void *), void *,
-                             void (*)(void *));
+                             continuation_ftype *, void *,
+                             continuation_free_arg_ftype *);
 extern void do_all_continuations (void);
 extern void do_all_continuations_thread (struct thread_info *);
 extern void discard_all_continuations (void);
 extern void discard_all_continuations_thread (struct thread_info *);
 
 extern void add_intermediate_continuation (struct thread_info *,
-                                          void (*)(void *), void *,
-                                          void (*)(void *));
+                                          continuation_ftype *, void *,
+                                          continuation_free_arg_ftype *);
 extern void do_all_intermediate_continuations (void);
 extern void do_all_intermediate_continuations_thread (struct thread_info *);
 extern void discard_all_intermediate_continuations (void);
@@ -762,9 +770,9 @@ extern void discard_all_intermediate_continuations_thread (struct thread_info *)
 
 /* Inferior specific (any thread) continuations.  */
 
-extern void add_inferior_continuation (void (*) (void *),
+extern void add_inferior_continuation (continuation_ftype *,
                                       void *,
-                                      void (*) (void *));
+                                      continuation_free_arg_ftype *);
 extern void do_all_inferior_continuations (void);
 extern void discard_all_inferior_continuations (struct inferior *inf);