[PATCH 1/2] Standartize on C99 inline

Tomas Carnecky tomas.carnecky at gmail.com
Thu Mar 22 02:50:13 PDT 2012


The current code uses a mix of inline, __inline, __inline__ and _X_INLINE.
Settle on C99 inline, but add AC_C_INLINE to configure.ac to take care
of old compilers. Also remove reference to _X_INLINE in doc/c-extensions.

Signed-off-by: Tomas Carnecky <tomas.carnecky at gmail.com>
---
 Xext/security.c             |    2 +-
 configure.ac                |    1 +
 dix/region.c                |    4 ++--
 dix/resource.c              |    2 +-
 dix/selection.c             |    2 +-
 doc/c-extensions            |    2 --
 exa/exa_classic.c           |    2 +-
 exa/exa_driver.c            |    2 +-
 exa/exa_mixed.c             |    2 +-
 exa/exa_priv.h              |    2 +-
 hw/xfree86/modes/xf86Crtc.h |    6 +++---
 mi/miarc.c                  |    4 ++--
 mi/mifpoly.h                |    2 +-
 13 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/Xext/security.c b/Xext/security.c
index 3699510..45dd950 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -146,7 +146,7 @@ SecurityLabelInitial(void)
 /*
  * Looks up a request name
  */
-static _X_INLINE const char *
+static inline const char *
 SecurityLookupRequestName(ClientPtr client)
 {
     return LookupRequestName(client->majorOp, client->minorOp);
diff --git a/configure.ac b/configure.ac
index 65d29f2..bf77b91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,6 +136,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
+AC_C_INLINE
 AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
 
 AC_CHECK_SIZEOF([unsigned long])
diff --git a/dix/region.c b/dix/region.c
index 737d2a8..4a0d847 100644
--- a/dix/region.c
+++ b/dix/region.c
@@ -383,7 +383,7 @@ RegionRectAlloc(RegionPtr pRgn, int n)
  *
  *-----------------------------------------------------------------------
  */
-_X_INLINE static int
+static inline int
 RegionCoalesce(RegionPtr pReg,  /* Region to coalesce                */
                int prevStart,   /* Index of start of previous band   */
                int curStart)
@@ -468,7 +468,7 @@ RegionCoalesce(RegionPtr pReg,  /* Region to coalesce                */
  *-----------------------------------------------------------------------
  */
 
-_X_INLINE static Bool
+static inline Bool
 RegionAppendNonO(RegionPtr pReg, BoxPtr r, BoxPtr rEnd, int y1, int y2)
 {
     BoxPtr pNextRect;
diff --git a/dix/resource.c b/dix/resource.c
index 89d0776..b728e34 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -232,7 +232,7 @@ static const struct ResourceType predefTypes[] = {
 
 CallbackListPtr ResourceStateCallback;
 
-static _X_INLINE void
+static inline void
 CallResourceStateCallback(ResourceState state, ResourceRec * res)
 {
     if (ResourceStateCallback) {
diff --git a/dix/selection.c b/dix/selection.c
index dfdcfdc..3e3a0b4 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -101,7 +101,7 @@ InitSelections(void)
     CurrentSelections = NULL;
 }
 
-static _X_INLINE void
+static inline void
 CallSelectionCallback(Selection * pSel, ClientPtr client,
                       SelectionCallbackKind kind)
 {
diff --git a/doc/c-extensions b/doc/c-extensions
index eb33e27..a7b0f29 100644
--- a/doc/c-extensions
+++ b/doc/c-extensions
@@ -21,8 +21,6 @@ extensions, although the results may not be optimal.
                  table.
     * _X_INTERNAL: like _X_HIDDEN, but attempt to ensure that this function
                    is never called from another module.
-    * _X_INLINE: inline this functon if possible (generally obeyed unless
-                 disabling optimisations).
     * _X_DEPRECATED: warn on use of this function.
 
 Mandatory extensions:
diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index 1fa534b..485ab89 100644
--- a/exa/exa_classic.c
+++ b/exa/exa_classic.c
@@ -33,7 +33,7 @@
 
 /* This file holds the classic exa specific implementation. */
 
-static _X_INLINE void *
+static inline void *
 ExaGetPixmapAddress(PixmapPtr p)
 {
     ExaPixmapPriv(p);
diff --git a/exa/exa_driver.c b/exa/exa_driver.c
index d467ca9..e83e0d0 100644
--- a/exa/exa_driver.c
+++ b/exa/exa_driver.c
@@ -33,7 +33,7 @@
 
 /* This file holds the driver allocated pixmaps specific implementation. */
 
-static _X_INLINE void *
+static inline void *
 ExaGetPixmapAddress(PixmapPtr p)
 {
     ExaPixmapPriv(p);
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 0681731..3904f8f 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -34,7 +34,7 @@
 /* This file holds the driver allocated pixmaps + better initial placement code.
  */
 
-static _X_INLINE void *
+static inline void *
 ExaGetPixmapAddress(PixmapPtr p)
 {
     ExaPixmapPriv(p);
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index bde78c3..ce37a0f 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -458,7 +458,7 @@ ExaCheckAddTraps(PicturePtr pPicture,
 
 /* exa_accel.c */
 
-static _X_INLINE Bool
+static inline Bool
 exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
                       unsigned int fillStyle, unsigned char alu,
                       unsigned int clientClipType)
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index a6a3c2e..89fa49e 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -687,7 +687,7 @@ extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
 
 #define XF86_CRTC_CONFIG_PTR(p)	((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
 
-static _X_INLINE xf86OutputPtr
+static inline xf86OutputPtr
 xf86CompatOutput(ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -695,7 +695,7 @@ xf86CompatOutput(ScrnInfoPtr pScrn)
     return config->output[config->compat_output];
 }
 
-static _X_INLINE xf86CrtcPtr
+static inline xf86CrtcPtr
 xf86CompatCrtc(ScrnInfoPtr pScrn)
 {
     xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
@@ -705,7 +705,7 @@ xf86CompatCrtc(ScrnInfoPtr pScrn)
     return compat_output->crtc;
 }
 
-static _X_INLINE RRCrtcPtr
+static inline RRCrtcPtr
 xf86CompatRRCrtc(ScrnInfoPtr pScrn)
 {
     xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
diff --git a/mi/miarc.c b/mi/miarc.c
index 0f6448b..5872499 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -102,13 +102,13 @@ cbrt(double x)
 #undef max
 #undef min
 
-_X_INLINE static int
+static inline int
 max(const int x, const int y)
 {
     return x > y ? x : y;
 }
 
-_X_INLINE static int
+static inline int
 min(const int x, const int y)
 {
     return x < y ? x : y;
diff --git a/mi/mifpoly.h b/mi/mifpoly.h
index f853fb4..dd4ebdb 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -67,7 +67,7 @@ SOFTWARE.
 #define SQSECANT 108.856472512142       /* 1/sin^2(11/2) - for 11o miter cutoff */
 #define D2SECANT 5.21671526231167       /* 1/2*sin(11/2) - max extension per width */
 
-static _X_INLINE int
+static inline int
 ICEIL(double x)
 {
     int _cTmp = x;
-- 
1.7.9.3



More information about the xorg-devel mailing list