[PATCH 1/3] Standartize on C99 inline

Tomas Carnecky tom at dbservice.com
Fri Mar 20 10:36:54 PDT 2009


The current code uses a mix of inline, __inline, __inline__ and _X_INLINE.
Standartize 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 <tom at dbservice.com>
---
 Xext/security.c  |    2 +-
 configure.ac     |    1 +
 dix/privates.c   |    2 +-
 dix/resource.c   |    2 +-
 dix/selection.c  |    2 +-
 doc/c-extensions |    2 --
 exa/exa.c        |    2 +-
 exa/exa_priv.h   |    2 +-
 mi/miarc.c       |    4 ++--
 mi/mifpoly.h     |    2 +-
 mi/miregion.c    |    4 ++--
 11 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/Xext/security.c b/Xext/security.c
index c9077c8..ad80e5f 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -143,7 +143,7 @@ SecurityLabelInitial(void)
 /*
  * Looks up a request name
  */
-static _X_INLINE const char *
+static inline const char *
 SecurityLookupRequestName(ClientPtr client)
 {
     int major = ((xReq *)client->requestBuffer)->reqType;
diff --git a/configure.ac b/configure.ac
index f4e1dbb..f02292f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.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/privates.c b/dix/privates.c
index 3a2deb8..cbe8347 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -73,7 +73,7 @@ findItem(const DevPrivateKey key)
     return items + *key;
 }
 
-static _X_INLINE int
+static inline int
 privateExists(PrivateRec **privates, const DevPrivateKey key)
 {
     return *key && *privates &&
diff --git a/dix/resource.c b/dix/resource.c
index dc6945d..53d765d 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -193,7 +193,7 @@ static DeleteType *DeleteFuncs = (DeleteType *)NULL;
 
 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 d72f381..0e5282c 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -102,7 +102,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.c b/exa/exa.c
index 10abf06..a5a2a2c 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -48,7 +48,7 @@ DevPrivateKey exaGCPrivateKey = &exaGCPrivateKeyIndex;
 static ShmFuncs exaShmFuncs = { NULL, NULL };
 #endif
 
-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 9efbbc9..1a77107 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -413,7 +413,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)
 {
diff --git a/mi/miarc.c b/mi/miarc.c
index a3e2580..7f062c8 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -103,12 +103,12 @@ cbrt(double x)
 #undef max
 #undef min
 
-_X_INLINE static int max (const int x, const int y)
+static inline int max (const int x, const int y)
 {
 	return x>y? x:y;
 }
 
-_X_INLINE static int min (const int x, const int y)
+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 ffd19a3..7db07ff 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -68,7 +68,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 ICEIL(double x)
+static inline int ICEIL(double x)
 {
     int _cTmp = x;
     return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
diff --git a/mi/miregion.c b/mi/miregion.c
index c48befc..9636614 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -426,7 +426,7 @@ miRegionCopy(RegionPtr dst, RegionPtr src)
  *
  *-----------------------------------------------------------------------
  */
-_X_INLINE static int
+static inline int
 miCoalesce (
     RegionPtr	pReg,	    	/* Region to coalesce		     */
     int	    	  	prevStart,  	/* Index of start of previous band   */
@@ -510,7 +510,7 @@ miCoalesce (
  *-----------------------------------------------------------------------
  */
 
-_X_INLINE static Bool
+static inline Bool
 miAppendNonO (
     RegionPtr	pReg,
     BoxPtr	r,
-- 
1.6.2




More information about the xorg-devel mailing list