[Spice-devel,spice-common] marshaller: Use static inline for deprecated functions

Submitted by Frediano Ziglio on Dec. 8, 2016, 1:12 p.m.

Details

Message ID 20161208131252.31513-1-fziglio@redhat.com
State Rejected
Headers show
Series "marshaller: Use static inline for deprecated functions" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Dec. 8, 2016, 1:12 p.m.
Compiler threats static inline functions in a different way avoiding
emitting code if functions are not used.
This avoid unused function to generate code and duplicate symbols.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 common/marshaller.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/common/marshaller.h b/common/marshaller.h
index 9ae1bdf..9af200c 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -42,16 +42,19 @@  uint8_t *spice_marshaller_add_by_ref(SpiceMarshaller *m, const uint8_t *data, si
 uint8_t *spice_marshaller_add_by_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size,
                                           spice_marshaller_item_free_func free_data, void *opaque);
 void spice_marshaller_add_chunks_by_ref(SpiceMarshaller *m, SpiceChunks *chunks);
-SPICE_GNUC_DEPRECATED inline uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, const uint8_t *data, size_t size)
+SPICE_GNUC_DEPRECATED static inline uint8_t *
+spice_marshaller_add_ref(SpiceMarshaller *m, const uint8_t *data, size_t size)
 {
     return spice_marshaller_add_by_ref(m, data, size);
 }
-SPICE_GNUC_DEPRECATED inline uint8_t *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size,
-                                              spice_marshaller_item_free_func free_data, void *opaque)
+SPICE_GNUC_DEPRECATED static inline uint8_t *
+spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size,
+                              spice_marshaller_item_free_func free_data, void *opaque)
 {
     return spice_marshaller_add_by_ref_full(m, data, size, free_data, opaque);
 }
-SPICE_GNUC_DEPRECATED inline void spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks)
+SPICE_GNUC_DEPRECATED static inline void
+spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks)
 {
     spice_marshaller_add_chunks_by_ref(m, chunks);
 }

Comments

Hey,

rather remove the deprecated function. spice-common is not api/abi
stable library

Pavel

On Thu, 2016-12-08 at 13:12 +0000, Frediano Ziglio wrote:
> Compiler threats static inline functions in a different way avoiding
> emitting code if functions are not used.
> This avoid unused function to generate code and duplicate symbols.
> 
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  common/marshaller.h | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/common/marshaller.h b/common/marshaller.h
> index 9ae1bdf..9af200c 100644
> --- a/common/marshaller.h
> +++ b/common/marshaller.h
> @@ -42,16 +42,19 @@ uint8_t
> *spice_marshaller_add_by_ref(SpiceMarshaller *m, const uint8_t
> *data, si
>  uint8_t *spice_marshaller_add_by_ref_full(SpiceMarshaller *m,
> uint8_t *data, size_t size,
>                                            spice_marshaller_item_fre
> e_func free_data, void *opaque);
>  void spice_marshaller_add_chunks_by_ref(SpiceMarshaller *m,
> SpiceChunks *chunks);
> -SPICE_GNUC_DEPRECATED inline uint8_t
> *spice_marshaller_add_ref(SpiceMarshaller *m, const uint8_t *data,
> size_t size)
> +SPICE_GNUC_DEPRECATED static inline uint8_t *
> +spice_marshaller_add_ref(SpiceMarshaller *m, const uint8_t *data,
> size_t size)
>  {
>      return spice_marshaller_add_by_ref(m, data, size);
>  }
> -SPICE_GNUC_DEPRECATED inline uint8_t
> *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data,
> size_t size,
> -                                              spice_marshaller_item
> _free_func free_data, void *opaque)
> +SPICE_GNUC_DEPRECATED static inline uint8_t *
> +spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data,
> size_t size,
> +                              spice_marshaller_item_free_func
> free_data, void *opaque)
>  {
>      return spice_marshaller_add_by_ref_full(m, data, size,
> free_data, opaque);
>  }
> -SPICE_GNUC_DEPRECATED inline void
> spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks
> *chunks)
> +SPICE_GNUC_DEPRECATED static inline void
> +spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks
> *chunks)
>  {
>      spice_marshaller_add_chunks_by_ref(m, chunks);
>  }