[Spice-devel] [PATCH 6/6] common: use INLINE instead of inline
Arnon Gilboa
agilboa at redhat.com
Thu May 12 02:37:31 PDT 2011
needed for spice/common files used by the client, server & qxl driver.
in windows _inline works for both c/c++, while inline is c++ only.
compiling the client with mixed c/c++ code required this define.
---
common/bitops.h | 6 ++++--
common/canvas_utils.c | 2 +-
common/lines.c | 3 +--
common/lz_config.h | 11 +----------
common/pixman_utils.c | 6 +++---
common/quic_config.h | 16 +++-------------
common/rect.h | 14 +++++++-------
7 files changed, 20 insertions(+), 38 deletions(-)
diff --git a/common/bitops.h b/common/bitops.h
index 666d82d..4823662 100644
--- a/common/bitops.h
+++ b/common/bitops.h
@@ -21,12 +21,14 @@
#ifndef BITOPS_H
#define BITOPS_H
+#include <spice/macros.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
-static inline int spice_bit_find_msb(uint32_t val)
+static INLINE int spice_bit_find_msb(uint32_t val)
{
uint32_t r;
__asm {
@@ -74,7 +76,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 604f589..55b7159 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -100,7 +100,7 @@ spice_pixman_image_get_format(pixman_image_t *image)
CANVAS_ERROR("Unknown pixman image type");
}
-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 baf1ce9..8731fb7 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -84,8 +84,7 @@ typedef struct lineGC *GCPtr;
#define miWideDash spice_canvas_wide_dash_line
#define miWideLine spice_canvas_wide_line
-static int inline
-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_config.h b/common/lz_config.h
index 439f413..d8675a8 100644
--- a/common/lz_config.h
+++ b/common/lz_config.h
@@ -25,24 +25,15 @@
#include <spice/macros.h>
#ifdef __GNUC__
-
#include <string.h>
-
-#define INLINE inline
-
#else
-
#ifdef QXLDD
#include <windef.h>
#include "os_dep.h"
-#define INLINE _inline
-
#else
#include <stddef.h>
#include <string.h>
-
-#define INLINE inline
#endif // QXLDD
-
#endif //__GNUC__
+
#endif //__LZ_CONFIG_H
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index 9f3f1de..612ddd8 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -1037,7 +1037,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;
@@ -1048,7 +1048,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) |
@@ -1310,7 +1310,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_config.h b/common/quic_config.h
index da5e51c..2a87f20 100644
--- a/common/quic_config.h
+++ b/common/quic_config.h
@@ -20,36 +20,26 @@
#define __QUIC_CONFIG_H
#include <spice/types.h>
+#include <spice/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUC__
-
#include <string.h>
-
-#define INLINE inline
-
#define MEMCLEAR(ptr, size) memset(ptr, 0, size)
-
#else
-
#ifdef QXLDD
#include <windef.h>
#include "os_dep.h"
-#define INLINE _inline
#define MEMCLEAR(ptr, size) RtlZeroMemory(ptr, size)
#else
#include <stddef.h>
#include <string.h>
-
-#define INLINE inline
#define MEMCLEAR(ptr, size) memset(ptr, 0, size)
-#endif
-
-
-#endif
+#endif // QXLDD
+#endif //__GNUC__
#ifdef __cplusplus
}
diff --git a/common/rect.h b/common/rect.h
index 6d7c446..360cb9d 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -26,7 +26,7 @@
extern "C" {
#endif
-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);
@@ -37,7 +37,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;
@@ -45,24 +45,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);
@@ -70,7 +70,7 @@ 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;
--
1.7.4.1
More information about the Spice-devel
mailing list