[Spice-devel] [PATCH] Remove use of INLINE
Marc-André Lureau
mlureau at redhat.com
Thu Aug 20 09:15:46 PDT 2015
ack
----- Original Message -----
> From: Alon Levy <alon at pobox.com>
>
> It's #define'd to 'inline', and only used in the GLZ encoder.
> ---
> server/glz_encode_match_tmpl.c | 4 ++--
> server/glz_encode_tmpl.c | 2 +-
> server/glz_encoder.c | 14 +++++++-------
> server/glz_encoder_config.h | 2 --
> server/glz_encoder_dictionary.c | 16 ++++++++--------
> 5 files changed, 18 insertions(+), 20 deletions(-)
>
> diff --git a/server/glz_encode_match_tmpl.c b/server/glz_encode_match_tmpl.c
> index b793e7f..1fd251e 100644
> --- a/server/glz_encode_match_tmpl.c
> +++ b/server/glz_encode_match_tmpl.c
> @@ -28,10 +28,10 @@
> /* if image_distance = 0, pixel_distance is the distance between the
> matching pixels.
> Otherwise, it is the offset from the beginning of the referred image */
> #if defined(GLZ_ENCODE_MATCH) /* actually performing the encoding */
> -static INLINE void encode_match(Encoder *encoder, uint32_t image_distance,
> +static inline void encode_match(Encoder *encoder, uint32_t image_distance,
> size_t pixel_distance, size_t len)
> #elif defined(GLZ_ENCODE_SIZE) /* compute the size of the encoding except
> for the match length*/
> -static INLINE int get_encode_ref_size(uint32_t image_distance, size_t
> pixel_distance)
> +static inline int get_encode_ref_size(uint32_t image_distance, size_t
> pixel_distance)
> #endif
> {
> #if defined(GLZ_ENCODE_SIZE)
> diff --git a/server/glz_encode_tmpl.c b/server/glz_encode_tmpl.c
> index 1402f95..89092a9 100644
> --- a/server/glz_encode_tmpl.c
> +++ b/server/glz_encode_tmpl.c
> @@ -144,7 +144,7 @@
> /* returns the length of the match. 0 if no match.
> if image_distance = 0, pixel_distance is the distance between the matching
> pixels.
> Otherwise, it is the offset from the beginning of the referred image */
> -static INLINE size_t FNAME(do_match)(SharedDictionary *dict,
> +static inline size_t FNAME(do_match)(SharedDictionary *dict,
> WindowImageSegment *ref_seg, const
> PIXEL *ref,
> const PIXEL *ref_limit,
> WindowImageSegment *ip_seg, const
> PIXEL *ip,
> diff --git a/server/glz_encoder.c b/server/glz_encoder.c
> index 5e1a694..d9d6be1 100644
> --- a/server/glz_encoder.c
> +++ b/server/glz_encoder.c
> @@ -50,7 +50,7 @@ typedef struct Encoder {
> /**************************************************************************
> * Handling writing the encoded image to the output buffer
> ***************************************************************************/
> -static INLINE int more_io_bytes(Encoder *encoder)
> +static inline int more_io_bytes(Encoder *encoder)
> {
> uint8_t *io_ptr;
> int num_io_bytes = encoder->usr->more_space(encoder->usr, &io_ptr);
> @@ -60,7 +60,7 @@ static INLINE int more_io_bytes(Encoder *encoder)
> return num_io_bytes;
> }
>
> -static INLINE void encode(Encoder *encoder, uint8_t byte)
> +static inline void encode(Encoder *encoder, uint8_t byte)
> {
> if (encoder->io.now == encoder->io.end) {
> if (more_io_bytes(encoder) <= 0) {
> @@ -73,7 +73,7 @@ static INLINE void encode(Encoder *encoder, uint8_t byte)
> *(encoder->io.now++) = byte;
> }
>
> -static INLINE void encode_32(Encoder *encoder, unsigned int word)
> +static inline void encode_32(Encoder *encoder, unsigned int word)
> {
> encode(encoder, (uint8_t)(word >> 24));
> encode(encoder, (uint8_t)(word >> 16) & 0x0000ff);
> @@ -81,26 +81,26 @@ static INLINE void encode_32(Encoder *encoder, unsigned
> int word)
> encode(encoder, (uint8_t)(word & 0x0000ff));
> }
>
> -static INLINE void encode_64(Encoder *encoder, uint64_t word)
> +static inline void encode_64(Encoder *encoder, uint64_t word)
> {
> encode_32(encoder, (uint32_t)(word >> 32));
> encode_32(encoder, (uint32_t)(word & 0xffffff));
> }
>
> -static INLINE void encode_copy_count(Encoder *encoder, uint8_t copy_count)
> +static inline void encode_copy_count(Encoder *encoder, uint8_t copy_count)
> {
> encode(encoder, copy_count);
> encoder->io.last_copy = encoder->io.now - 1; // io_now cannot be the
> first byte of the buffer
> }
>
> -static INLINE void update_copy_count(Encoder *encoder, uint8_t copy_count)
> +static inline void update_copy_count(Encoder *encoder, uint8_t copy_count)
> {
> GLZ_ASSERT(encoder->usr, encoder->io.last_copy);
> *(encoder->io.last_copy) = copy_count;
> }
>
> // decrease the io ptr by 1
> -static INLINE void compress_output_prev(Encoder *encoder)
> +static inline void compress_output_prev(Encoder *encoder)
> {
> // io_now cannot be the first byte of the buffer
> encoder->io.now--;
> diff --git a/server/glz_encoder_config.h b/server/glz_encoder_config.h
> index 886c68b..6472668 100644
> --- a/server/glz_encoder_config.h
> +++ b/server/glz_encoder_config.h
> @@ -55,7 +55,5 @@ struct GlzEncoderUsrContext {
>
> #endif
>
> -#define INLINE inline
> -
>
> #endif
> diff --git a/server/glz_encoder_dictionary.c
> b/server/glz_encoder_dictionary.c
> index df346d0..ba6065f 100644
> --- a/server/glz_encoder_dictionary.c
> +++ b/server/glz_encoder_dictionary.c
> @@ -27,7 +27,7 @@
>
> /* turning all used images to free ones. If they are alive, calling the
> free_image callback for
> each one */
> -static INLINE void __glz_dictionary_window_reset_images(SharedDictionary
> *dict)
> +static inline void __glz_dictionary_window_reset_images(SharedDictionary
> *dict)
> {
> WindowImage *tmp;
>
> @@ -108,7 +108,7 @@ static void glz_dictionary_window_reset(SharedDictionary
> *dict)
> __glz_dictionary_window_reset_images(dict);
> }
>
> -static INLINE void glz_dictionary_reset_hash(SharedDictionary *dict)
> +static inline void glz_dictionary_reset_hash(SharedDictionary *dict)
> {
> memset(dict->htab, 0, sizeof(HashEntry) * HASH_SIZE * HASH_CHAIN_SIZE);
> #ifdef CHAINED_HASH
> @@ -116,7 +116,7 @@ static INLINE void
> glz_dictionary_reset_hash(SharedDictionary *dict)
> #endif
> }
>
> -static INLINE void glz_dictionary_window_destroy(SharedDictionary *dict)
> +static inline void glz_dictionary_window_destroy(SharedDictionary *dict)
> {
> __glz_dictionary_window_reset_images(dict);
>
> @@ -139,7 +139,7 @@ static INLINE void
> glz_dictionary_window_destroy(SharedDictionary *dict)
> }
>
> /* logic removal only */
> -static INLINE void glz_dictionary_window_kill_image(SharedDictionary *dict,
> WindowImage *image)
> +static inline void glz_dictionary_window_kill_image(SharedDictionary *dict,
> WindowImage *image)
> {
> image->is_alive = FALSE;
> }
> @@ -255,7 +255,7 @@ void glz_enc_dictionary_remove_image(GlzEncDictContext
> *opaque_dict,
> Mutators of the window. Should be called by the encoder before and after
> encoding.
> ***********************************************************************************/
>
> -static INLINE int __get_pixels_num(LzImageType image_type, unsigned int
> num_lines, int stride)
> +static inline int __get_pixels_num(LzImageType image_type, unsigned int
> num_lines, int stride)
> {
> if (IS_IMAGE_TYPE_RGB[image_type]) {
> return num_lines * stride / RGB_BYTES_PER_PIXEL[image_type];
> @@ -356,7 +356,7 @@ static uint32_t
> __glz_dictionary_window_alloc_image_seg(SharedDictionary *dict)
> }
>
> /* moves image to free list and "kill" it. Calls the free_image callback if
> was alive. */
> -static INLINE void __glz_dictionary_window_free_image(SharedDictionary
> *dict, WindowImage *image)
> +static inline void __glz_dictionary_window_free_image(SharedDictionary
> *dict, WindowImage *image)
> {
> if (image->is_alive) {
> dict->cur_usr->free_image(dict->cur_usr, image->usr_context);
> @@ -367,7 +367,7 @@ static INLINE void
> __glz_dictionary_window_free_image(SharedDictionary *dict, Wi
> }
>
> /* moves all the segments that were associated with the images to the free
> segments */
> -static INLINE void __glz_dictionary_window_free_image_segs(SharedDictionary
> *dict,
> +static inline void __glz_dictionary_window_free_image_segs(SharedDictionary
> *dict,
> WindowImage
> *image)
> {
> uint32_t old_free_head = dict->window.free_segs_head;
> @@ -423,7 +423,7 @@ static WindowImage
> *glz_dictionary_window_get_new_head(SharedDictionary *dict, i
> return cur_head;
> }
>
> -static INLINE int glz_dictionary_is_in_use(SharedDictionary *dict)
> +static inline int glz_dictionary_is_in_use(SharedDictionary *dict)
> {
> uint32_t i = 0;
> for (i = 0; i < dict->max_encoders; i++) {
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list