diff mbox

[04/28] timer: use an inline function for free

Message ID 20170207135211.15870-5-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Feb. 7, 2017, 1:51 p.m. UTC
Similarly to allocation, do it from an inline function. This allows
tests to only use the headers for allocation/free of timer.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/qemu/timer.h | 5 ++++-
 qemu-timer.c         | 5 -----
 2 files changed, 4 insertions(+), 6 deletions(-)

Comments

Greg Kurz Feb. 7, 2017, 4:35 p.m. UTC | #1
On Tue,  7 Feb 2017 17:51:47 +0400
Marc-André Lureau <marcandre.lureau@redhat.com> wrote:

> Similarly to allocation, do it from an inline function. This allows
> tests to only use the headers for allocation/free of timer.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  include/qemu/timer.h | 5 ++++-
>  qemu-timer.c         | 5 -----
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 9abed51ae8..26e628584c 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -610,7 +610,10 @@ void timer_deinit(QEMUTimer *ts);
>   *
>   * Free a timer (it must not be on the active list)
>   */
> -void timer_free(QEMUTimer *ts);
> +static inline void timer_free(QEMUTimer *ts)
> +{
> +    g_free(ts);
> +}
>  
>  /**
>   * timer_del:
> diff --git a/qemu-timer.c b/qemu-timer.c
> index ff620ecff7..6cf70b96f6 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -355,11 +355,6 @@ void timer_deinit(QEMUTimer *ts)
>      ts->timer_list = NULL;
>  }
>  
> -void timer_free(QEMUTimer *ts)
> -{
> -    g_free(ts);
> -}
> -
>  static void timer_del_locked(QEMUTimerList *timer_list, QEMUTimer *ts)
>  {
>      QEMUTimer **pt, *t;
diff mbox

Patch

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 9abed51ae8..26e628584c 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -610,7 +610,10 @@  void timer_deinit(QEMUTimer *ts);
  *
  * Free a timer (it must not be on the active list)
  */
-void timer_free(QEMUTimer *ts);
+static inline void timer_free(QEMUTimer *ts)
+{
+    g_free(ts);
+}
 
 /**
  * timer_del:
diff --git a/qemu-timer.c b/qemu-timer.c
index ff620ecff7..6cf70b96f6 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -355,11 +355,6 @@  void timer_deinit(QEMUTimer *ts)
     ts->timer_list = NULL;
 }
 
-void timer_free(QEMUTimer *ts)
-{
-    g_free(ts);
-}
-
 static void timer_del_locked(QEMUTimerList *timer_list, QEMUTimer *ts)
 {
     QEMUTimer **pt, *t;