common: use INLINE instead of inline

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.
This commit is contained in:
Arnon Gilboa 2011-05-12 15:09:12 +03:00
parent 9cfbd8e527
commit 0b1b126b1e
7 changed files with 20 additions and 38 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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)));
}

View File

@ -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
}

14
rect.h
View File

@ -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;