[Spice-devel] [PATCH spice-common] Remove INLINE usage

Marc-André Lureau marcandre.lureau at gmail.com
Fri Oct 4 12:45:31 CEST 2013


Since inline is c99 and its already used in some files
---
 common/bitops.h       |  6 +++---
 common/canvas_utils.c |  2 +-
 common/lines.c        |  2 +-
 common/lz.c           | 26 +++++++++++++-------------
 common/pixman_utils.c |  6 +++---
 common/quic.c         | 22 +++++++++++-----------
 common/quic_tmpl.c    | 12 ++++++------
 common/rect.h         | 20 ++++++++++----------
 spice-protocol        |  2 +-
 9 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/common/bitops.h b/common/bitops.h
index d1cae0c..eb294fe 100644
--- a/common/bitops.h
+++ b/common/bitops.h
@@ -39,7 +39,7 @@ static inline int spice_bit_find_msb(unsigned int val)
 }
 
 #elif defined(WIN32) && !defined(_WIN64)
-static INLINE int spice_bit_find_msb(uint32_t val)
+static inline int spice_bit_find_msb(uint32_t val)
 {
     uint32_t r;
     __asm {
@@ -54,7 +54,7 @@ found:
 }
 
 #else
-static INLINE int spice_bit_find_msb(unsigned int val)
+static inline int spice_bit_find_msb(unsigned int val)
 {
     signed char index = 31;
 
@@ -74,7 +74,7 @@ static INLINE int spice_bit_find_msb(unsigned int val)
 
 #endif
 
-static INLINE int spice_bit_next_pow2(unsigned int val)
+static inline int spice_bit_next_pow2(unsigned int val)
 {
     if ((val & (val - 1)) == 0) {
         return val;
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index feb89cb..297b8ce 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -94,7 +94,7 @@ int spice_pixman_image_get_format(pixman_image_t *image, pixman_format_code_t *f
     return 0;
 }
 
-static INLINE pixman_image_t *__surface_create_stride(pixman_format_code_t format, int width, int height,
+static inline pixman_image_t *__surface_create_stride(pixman_format_code_t format, int width, int height,
                                                       int stride)
 {
     uint8_t *data;
diff --git a/common/lines.c b/common/lines.c
index 797d5d6..8b15e79 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -84,7 +84,7 @@ typedef struct lineGC *GCPtr;
 #define miWideDash spice_canvas_wide_dash_line
 #define miWideLine spice_canvas_wide_line
 
-static INLINE int ICEIL (double x)
+static inline int ICEIL (double x)
 {
     int _cTmp = (int)x;
     return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1;
diff --git a/common/lz.c b/common/lz.c
index aca3a16..d1c4033 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -101,7 +101,7 @@ typedef struct Encoder {
 /****************************************************/
 /* functions for managing the pool of image segments*/
 /****************************************************/
-static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder);
+static inline LzImageSegment *lz_alloc_image_seg(Encoder *encoder);
 static void lz_reset_image_seg(Encoder *encoder);
 static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines,
                                   unsigned int num_first_lines);
@@ -109,7 +109,7 @@ static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines,
 
 // return a free image segment if one exists. Make allocation if needed. adds it to the
 // tail of the image segments lists
-static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder)
+static inline LzImageSegment *lz_alloc_image_seg(Encoder *encoder)
 {
     LzImageSegment *ret;
 
@@ -136,7 +136,7 @@ static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder)
 }
 
 // adding seg to the head of free segments (lz_reset_image_seg removes it from used ones)
-static INLINE void __lz_free_image_seg(Encoder *encoder, LzImageSegment *seg)
+static inline void __lz_free_image_seg(Encoder *encoder, LzImageSegment *seg)
 {
     seg->next = encoder->free_image_segs;
     encoder->free_image_segs = seg;
@@ -212,7 +212,7 @@ error_1:
 /**************************************************************************
 * Handling encoding and decoding of a byte
 ***************************************************************************/
-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);
@@ -222,7 +222,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) {
@@ -235,7 +235,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);
@@ -243,25 +243,25 @@ static INLINE void encode_32(Encoder *encoder, unsigned int word)
     encode(encoder, (uint8_t)(word & 0x0000ff));
 }
 
-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)
 {
     spice_return_if_fail(encoder->io_last_copy);
     *(encoder->io_last_copy) = copy_count;
 }
 
-static INLINE void encode_level(Encoder *encoder, uint8_t level_code)
+static inline void encode_level(Encoder *encoder, uint8_t level_code)
 {
     *(encoder->io_start) |= level_code;
 }
 
 // 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--;
@@ -282,7 +282,7 @@ static int encoder_reset(Encoder *encoder, uint8_t *io_ptr, uint8_t *io_ptr_end)
     return TRUE;
 }
 
-static INLINE uint8_t decode(Encoder *encoder)
+static inline uint8_t decode(Encoder *encoder)
 {
     if (encoder->io_now == encoder->io_end) {
         int num_io_bytes = more_io_bytes(encoder);
@@ -295,7 +295,7 @@ static INLINE uint8_t decode(Encoder *encoder)
     return *(encoder->io_now++);
 }
 
-static INLINE uint32_t decode_32(Encoder *encoder)
+static inline uint32_t decode_32(Encoder *encoder)
 {
     uint32_t word = 0;
     word |= decode(encoder);
@@ -308,7 +308,7 @@ static INLINE uint32_t decode_32(Encoder *encoder)
     return word;
 }
 
-static INLINE int is_io_to_decode_end(Encoder *encoder)
+static inline int is_io_to_decode_end(Encoder *encoder)
 {
     if (encoder->io_now != encoder->io_end) {
         return FALSE;
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index 311c22e..db7a67f 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -1045,7 +1045,7 @@ pixman_image_t *spice_bitmap_try_as_pixman(int src_format,
 #define UINT32_FROM_LE(x) (x)
 #endif
 
-static INLINE uint32_t rgb_16_555_to_32(uint16_t color)
+static inline uint32_t rgb_16_555_to_32(uint16_t color)
 {
     uint32_t ret;
 
@@ -1056,7 +1056,7 @@ static INLINE uint32_t rgb_16_555_to_32(uint16_t color)
     return ret;
 }
 
-static INLINE uint16_t rgb_32_to_16_555(uint32_t color)
+static inline uint16_t rgb_32_to_16_555(uint32_t color)
 {
     return
         (((color) >> 3) & 0x001f) |
@@ -1327,7 +1327,7 @@ static void bitmap_4be_16_to_16_555(uint8_t* dest, int dest_stride,
     }
 }
 
-static INLINE int test_bit_be(void* addr, int bit)
+static inline int test_bit_be(void* addr, int bit)
 {
     return !!(((uint8_t*)addr)[bit >> 3] & (0x80 >> (bit & 0x07)));
 }
diff --git a/common/quic.c b/common/quic.c
index c9c3624..bcbf093 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -428,7 +428,7 @@ static void __write_io_word(Encoder *encoder)
 
 static void (*__write_io_word_ptr)(Encoder *encoder) = __write_io_word;
 
-static INLINE void write_io_word(Encoder *encoder)
+static inline void write_io_word(Encoder *encoder)
 {
     if (encoder->io_now == encoder->io_end) {
         __write_io_word_ptr(encoder); //disable inline optimizations
@@ -437,7 +437,7 @@ static INLINE void write_io_word(Encoder *encoder)
     *(encoder->io_now++) = encoder->io_word;
 }
 
-static INLINE void encode(Encoder *encoder, unsigned int word, unsigned int len)
+static inline void encode(Encoder *encoder, unsigned int word, unsigned int len)
 {
     int delta;
 
@@ -458,13 +458,13 @@ static INLINE void encode(Encoder *encoder, unsigned int word, unsigned int len)
     spice_assert((encoder->io_word & bppmask[encoder->io_available_bits]) == 0);
 }
 
-static INLINE void encode_32(Encoder *encoder, unsigned int word)
+static inline void encode_32(Encoder *encoder, unsigned int word)
 {
     encode(encoder, word >> 16, 16);
     encode(encoder, word & 0x0000ffff, 16);
 }
 
-static INLINE void flush(Encoder *encoder)
+static inline void flush(Encoder *encoder)
 {
     if (encoder->io_available_bits > 0 && encoder->io_available_bits != 32) {
         encode(encoder, 0, encoder->io_available_bits);
@@ -482,7 +482,7 @@ static void __read_io_word(Encoder *encoder)
 static void (*__read_io_word_ptr)(Encoder *encoder) = __read_io_word;
 
 
-static INLINE void read_io_word(Encoder *encoder)
+static inline void read_io_word(Encoder *encoder)
 {
     if (encoder->io_now == encoder->io_end) {
         __read_io_word_ptr(encoder); //disable inline optimizations
@@ -492,7 +492,7 @@ static INLINE void read_io_word(Encoder *encoder)
     encoder->io_next_word = *(encoder->io_now++);
 }
 
-static INLINE void decode_eatbits(Encoder *encoder, int len)
+static inline void decode_eatbits(Encoder *encoder, int len)
 {
     int delta;
 
@@ -512,7 +512,7 @@ static INLINE void decode_eatbits(Encoder *encoder, int len)
     encoder->io_word |= (encoder->io_next_word >> encoder->io_available_bits);
 }
 
-static INLINE void decode_eat32bits(Encoder *encoder)
+static inline void decode_eat32bits(Encoder *encoder)
 {
     decode_eatbits(encoder, 16);
     decode_eatbits(encoder, 16);
@@ -522,7 +522,7 @@ static INLINE void decode_eat32bits(Encoder *encoder)
 
 #ifdef RLE_STAT
 
-static INLINE void encode_ones(Encoder *encoder, unsigned int n)
+static inline void encode_ones(Encoder *encoder, unsigned int n)
 {
     unsigned int count;
 
@@ -718,7 +718,7 @@ static int decode_channel_run(Encoder *encoder, Channel *channel)
 
 #else
 
-static INLINE void encode_run(Encoder *encoder, unsigned int len)
+static inline void encode_run(Encoder *encoder, unsigned int len)
 {
     int odd = len & 1U;
     int msb;
@@ -739,7 +739,7 @@ static INLINE void encode_run(Encoder *encoder, unsigned int len)
     }
 }
 
-static INLINE unsigned int decode_run(Encoder *encoder)
+static inline unsigned int decode_run(Encoder *encoder)
 {
     unsigned int len = 0;
     int count;
@@ -761,7 +761,7 @@ static INLINE unsigned int decode_run(Encoder *encoder)
 #endif
 #endif
 
-static INLINE void init_decode_io(Encoder *encoder)
+static inline void init_decode_io(Encoder *encoder)
 {
     encoder->io_next_word = encoder->io_word = *(encoder->io_now++);
     encoder->io_available_bits = 0;
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index 75f2ff0..b1ddbc4 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -83,12 +83,12 @@ if (i > 1 && cur_row[i - 1].a == cur_row[i - 2].a && i != run_index) {  \
 #endif
 
 /*  a  */
-static INLINE BYTE FNAME(decorelate_0)(const PIXEL * const curr, const unsigned int bpc_mask)
+static inline BYTE FNAME(decorelate_0)(const PIXEL * const curr, const unsigned int bpc_mask)
 {
     return family.xlatU2L[(unsigned)((int)curr[0].a - (int)_PIXEL_A) & bpc_mask];
 }
 
-static INLINE void FNAME(corelate_0)(PIXEL *curr, const BYTE corelate,
+static inline void FNAME(corelate_0)(PIXEL *curr, const BYTE corelate,
                                      const unsigned int bpc_mask)
 {
     curr->a = (family.xlatL2U[corelate] + _PIXEL_A) & bpc_mask;
@@ -97,14 +97,14 @@ static INLINE void FNAME(corelate_0)(PIXEL *curr, const BYTE corelate,
 #ifdef PRED_1
 
 /*  (a+b)/2  */
-static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr,
+static inline BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr,
                                      const unsigned int bpc_mask)
 {
     return family.xlatU2L[(unsigned)((int)curr->a - (int)((_PIXEL_A + _PIXEL_B) >> 1)) & bpc_mask];
 }
 
 
-static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate,
+static inline void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate,
                                    const unsigned int bpc_mask)
 {
     curr->a = (family.xlatL2U[corelate] + (int)((_PIXEL_A + _PIXEL_B) >> 1)) & bpc_mask;
@@ -115,7 +115,7 @@ static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE co
 #ifdef PRED_2
 
 /*  .75a+.75b-.5c  */
-static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr,
+static inline BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr,
                                      const unsigned int bpc_mask)
 {
     int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2;
@@ -131,7 +131,7 @@ static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * cons
     }
 }
 
-static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate,
+static inline void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate,
                                    const unsigned int bpc_mask)
 {
     const int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2;
diff --git a/common/rect.h b/common/rect.h
index f8bacf1..8c9faed 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -25,7 +25,7 @@
 
 SPICE_BEGIN_DECLS
 
-static INLINE void rect_sect(SpiceRect* r, const SpiceRect* bounds)
+static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds)
 {
     r->left = MAX(r->left, bounds->left);
     r->right = MIN(r->right, bounds->right);
@@ -36,7 +36,7 @@ static INLINE void rect_sect(SpiceRect* r, const SpiceRect* bounds)
     r->bottom = MAX(r->top, r->bottom);
 }
 
-static INLINE void rect_offset(SpiceRect* r, int dx, int dy)
+static inline void rect_offset(SpiceRect* r, int dx, int dy)
 {
     r->left += dx;
     r->right += dx;
@@ -44,24 +44,24 @@ static INLINE void rect_offset(SpiceRect* r, int dx, int dy)
     r->bottom += dy;
 }
 
-static INLINE int rect_is_empty(const SpiceRect* r)
+static inline int rect_is_empty(const SpiceRect* r)
 {
     return r->top == r->bottom || r->left == r->right;
 }
 
-static INLINE int rect_intersects(const SpiceRect* r1, const SpiceRect* r2)
+static inline int rect_intersects(const SpiceRect* r1, const SpiceRect* r2)
 {
     return r1->left < r2->right && r1->right > r2->left &&
            r1->top < r2->bottom && r1->bottom > r2->top;
 }
 
-static INLINE int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2)
+static inline int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2)
 {
     return r1->top == r2->top && r1->left == r2->left &&
            r1->bottom == r2->bottom && r1->right == r2->right;
 }
 
-static INLINE void rect_union(SpiceRect *dest, const SpiceRect *r)
+static inline void rect_union(SpiceRect *dest, const SpiceRect *r)
 {
     dest->top = MIN(dest->top, r->top);
     dest->left = MIN(dest->left, r->left);
@@ -69,24 +69,24 @@ static INLINE void rect_union(SpiceRect *dest, const SpiceRect *r)
     dest->right = MAX(dest->right, r->right);
 }
 
-static INLINE int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2)
+static inline int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2)
 {
     return r1->right - r1->left == r2->right - r2->left &&
            r1->bottom - r1->top == r2->bottom - r2->top;
 }
 
-static INLINE int rect_contains(const SpiceRect *big, const SpiceRect *small)
+static inline int rect_contains(const SpiceRect *big, const SpiceRect *small)
 {
     return big->left <= small->left && big->right >= small->right &&
            big->top <= small->top && big->bottom >= small->bottom;
 }
 
-static INLINE int rect_get_area(const SpiceRect *r)
+static inline int rect_get_area(const SpiceRect *r)
 {
     return (r->right - r->left) * (r->bottom - r->top);
 }
 
-static INLINE void rect_debug(const SpiceRect *r)
+static inline void rect_debug(const SpiceRect *r)
 {
     spice_debug("(%d, %d) (%d, %d)", r->left, r->top, r->right, r->bottom);
 }
diff --git a/spice-protocol b/spice-protocol
index ba2192f..8b436f8 160000
--- a/spice-protocol
+++ b/spice-protocol
@@ -1 +1 @@
-Subproject commit ba2192f1eab041a7f462d33cc7d63fab653dfe16
+Subproject commit 8b436f8a3e3973fec9995c01b2657aaaf2aee034
-- 
1.8.3.1



More information about the Spice-devel mailing list