[Xcb] [PATCH util-image 11/12] Replace _X_INLINE with "inline" along with AC_C_INLINE

Uli Schlachter psychon at znc.in
Thu Apr 17 05:33:41 PDT 2014


On 04.04.2014 01:34, Gaetan Nadon wrote:
> For XCB, the functionality provided by AC_C_INLINE is sufficient.
> This macro will define inline if not already defined.

Doesn't it get defined in config.h? So this would need to install config.h and
include it in public headers which is a big no-no.

> This will allow us to later drop the dependency on x11proto if nothing
> else turns up needing it.
> 
> Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> ---
>  configure.ac       |    1 +
>  image/xcb_bitops.h |   16 ++++++++--------
>  image/xcb_pixel.h  |   20 ++++++++++----------
>  3 files changed, 19 insertions(+), 18 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 5a9a26c..4d1f07d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -5,6 +5,7 @@ AC_INIT([xcb-util-image],[0.3.9],
>  AC_CONFIG_SRCDIR([Makefile.am])
>  AC_CONFIG_HEADERS([config.h])
>  AC_CONFIG_MACRO_DIR([m4])
> +AC_C_INLINE
>  AM_INIT_AUTOMAKE([foreign dist-bzip2])
>  AM_MAINTAINER_MODE
>
> diff --git a/image/xcb_bitops.h b/image/xcb_bitops.h
> index a6872a1..d25bea7 100644
> --- a/image/xcb_bitops.h
> +++ b/image/xcb_bitops.h
> @@ -48,7 +48,7 @@
>   * rest of the word clear.
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_mask(uint32_t n)
>  {
>      return n == 32 ? ~0 : (1 << n) - 1;
> @@ -69,7 +69,7 @@ xcb_mask(uint32_t n)
>  
>  
>  /* 15 ops, 3 long immediates, 14 stages, 9 alu ops, 9 alu stages */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_popcount(uint32_t x)
>  {
>      uint32_t m1 = 0x55555555;
> @@ -94,7 +94,7 @@ xcb_popcount(uint32_t x)
>   * xcb_roundup().
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_roundup_2 (uint32_t base, uint32_t pad)
>  {
>      return (base + pad - 1) & -pad;
> @@ -111,7 +111,7 @@ xcb_roundup_2 (uint32_t base, uint32_t pad)
>   * xcb_rounddown().
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_rounddown_2 (uint32_t base, uint32_t pad)
>  {
>      return base & -pad;
> @@ -129,7 +129,7 @@ xcb_rounddown_2 (uint32_t base, uint32_t pad)
>   * instead.
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_roundup (uint32_t base, uint32_t pad)
>  {
>      uint32_t b = base + pad - 1;
> @@ -152,7 +152,7 @@ xcb_roundup (uint32_t base, uint32_t pad)
>   * instead.
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_rounddown (uint32_t base, uint32_t pad)
>  {
>      /* faster if pad is a power of two */
> @@ -171,7 +171,7 @@ xcb_rounddown (uint32_t base, uint32_t pad)
>   * Reverses the bottom @p n bits of @p x.
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_bit_reverse(uint32_t x, uint8_t n) {
>      uint32_t m1 = 0x00ff00ff;
>      uint32_t m2 = 0x0f0f0f0f;
> @@ -196,7 +196,7 @@ xcb_bit_reverse(uint32_t x, uint8_t n) {
>   * as appropriate.
>   * @ingroup xcb__bitops
>   */
> -_X_INLINE static xcb_image_order_t
> +inline static xcb_image_order_t
>  xcb_host_byte_order(void) {
>    uint32_t           endian_test = 0x01020304;
>  
> diff --git a/image/xcb_pixel.h b/image/xcb_pixel.h
> index fcb22b4..774c0c7 100644
> --- a/image/xcb_pixel.h
> +++ b/image/xcb_pixel.h
> @@ -51,7 +51,7 @@
>   * @ingroup xcb__image_t
>   */
>  
> -_X_INLINE static void
> +inline static void
>  xcb_image_put_pixel_XY32M (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y,
> @@ -66,7 +66,7 @@ xcb_image_put_pixel_XY32M (xcb_image_t *image,
>    *bp = (*bp & ~m) | p;
>  }
>  
> -_X_INLINE static void
> +inline static void
>  xcb_image_put_pixel_XY32L (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y,
> @@ -79,7 +79,7 @@ xcb_image_put_pixel_XY32L (xcb_image_t *image,
>    *bp = (*bp & ~m) | p;
>  }
>  
> -_X_INLINE static int
> +inline static int
>  xcb_image_get_pixel_XY32M (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y)
> @@ -91,7 +91,7 @@ xcb_image_get_pixel_XY32M (xcb_image_t *image,
>    return (*bp >> bit) & 1;
>  }
>  
> -_X_INLINE static int
> +inline static int
>  xcb_image_get_pixel_XY32L (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y)
> @@ -101,7 +101,7 @@ xcb_image_get_pixel_XY32L (xcb_image_t *image,
>    return (*bp >> bit) & 1;
>  }
>  
> -_X_INLINE static void
> +inline static void
>  xcb_image_put_pixel_Z8 (xcb_image_t *image,
>  			uint32_t x,
>  			uint32_t y,
> @@ -110,7 +110,7 @@ xcb_image_put_pixel_Z8 (xcb_image_t *image,
>    image->data[x + y * image->stride] = pixel;
>  }
>  
> -_X_INLINE static uint8_t
> +inline static uint8_t
>  xcb_image_get_pixel_Z8 (xcb_image_t *image,
>  			uint32_t x,
>  			uint32_t y)
> @@ -118,7 +118,7 @@ xcb_image_get_pixel_Z8 (xcb_image_t *image,
>    return image->data[x + y * image->stride];
>  }
>  
> -_X_INLINE static void
> +inline static void
>  xcb_image_put_pixel_Z32M (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y,
> @@ -131,7 +131,7 @@ xcb_image_put_pixel_Z32M (xcb_image_t *image,
>    row[(x << 2) + 3] = pixel;
>  }
>  
> -_X_INLINE static void
> +inline static void
>  xcb_image_put_pixel_Z32L (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y,
> @@ -144,7 +144,7 @@ xcb_image_put_pixel_Z32L (xcb_image_t *image,
>    row[(x << 2) + 3] = pixel >> 24;
>  }
>  
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_image_get_pixel_Z32M (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y)
> @@ -156,7 +156,7 @@ xcb_image_get_pixel_Z32M (xcb_image_t *image,
>    return pixel | row[(x << 2) + 3];
>  }
>  
> -_X_INLINE static uint32_t
> +inline static uint32_t
>  xcb_image_get_pixel_Z32L (xcb_image_t *image,
>  			  uint32_t x,
>  			  uint32_t y)
> 


-- 
Do Not Touch The Jellyfish! Get Me To The Hosp Immediately


More information about the Xcb mailing list