1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

Unified usage of the 'inline' attribute for functions

Autoconf provides the necessary stuff to detect if inline keyword
is supported, and to detect special syntaxes, so let's use this
and remove the multiple local definitions, this makes code simpler.
This commit is contained in:
Christophe CURIS
2013-05-11 00:07:13 +02:00
committed by Carlos R. Mafra
parent 7f6699ffca
commit 90d24a1648
8 changed files with 11 additions and 28 deletions

View File

@@ -1,3 +1,4 @@
#include <config.h>
#include <sys/types.h>
#include <string.h>
@@ -8,11 +9,6 @@
#define INITIAL_CAPACITY 23
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define INLINE inline
#else
# define INLINE
#endif
typedef struct HashItem {
const void *key;
@@ -39,7 +35,7 @@ typedef struct W_HashTable {
#define RELKEY(table, key) if ((table)->callbacks.releaseKey) \
(*(table)->callbacks.releaseKey)(key)
static INLINE unsigned hashString(const char *key)
static inline unsigned hashString(const char *key)
{
unsigned ret = 0;
unsigned ctr = 0;
@@ -52,7 +48,7 @@ static INLINE unsigned hashString(const char *key)
return ret;
}
static INLINE unsigned hashPtr(const void *key)
static inline unsigned hashPtr(const void *key)
{
return ((size_t) key / sizeof(char *));
}

View File

@@ -465,7 +465,7 @@ static char *indentedDescription(WMPropList * plist, int level)
return retstr;
}
static INLINE int getChar(PLData * pldata)
static inline int getChar(PLData * pldata)
{
int c;
@@ -482,7 +482,7 @@ static INLINE int getChar(PLData * pldata)
return c;
}
static INLINE int getNonSpaceChar(PLData * pldata)
static inline int getNonSpaceChar(PLData * pldata)
{
int c;

View File

@@ -29,12 +29,6 @@
# define _(text) (text)
#endif
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define INLINE inline
#else
# define INLINE
#endif
#endif /* WINGS_CONFIG_H_ */

View File

@@ -122,7 +122,7 @@ static WMSelectionProcs selectionHandler = {
#define TEXT_WIDTH2(tPtr, start, end) (WMWidthOfString((tPtr)->font, \
&((tPtr)->text[(start)]), (end) - (start)))
static INLINE int oneUTF8CharBackward(const char *str, int len)
static inline int oneUTF8CharBackward(const char *str, int len)
{
const unsigned char *ustr = (const unsigned char *)str;
int pos = 0;
@@ -131,7 +131,7 @@ static INLINE int oneUTF8CharBackward(const char *str, int len)
return pos;
}
static INLINE int oneUTF8CharForward(const char *str, int len)
static inline int oneUTF8CharForward(const char *str, int len)
{
const unsigned char *ustr = (const unsigned char *)str;
int pos = 0;
@@ -141,7 +141,7 @@ static INLINE int oneUTF8CharForward(const char *str, int len)
}
// find the beginning of the UTF8 char pointed by str
static INLINE int seekUTF8CharStart(const char *str, int len)
static inline int seekUTF8CharStart(const char *str, int len)
{
const unsigned char *ustr = (const unsigned char *)str;
int pos = 0;

View File

@@ -230,6 +230,7 @@ dnl Checks for typedefs, structures, and compiler characteristics.
dnl ==============================================================
AC_DECL_SYS_SIGLIST
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL

View File

@@ -397,11 +397,5 @@
#define M_(text) (text)
#endif
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define INLINE inline
#else
#define INLINE
#endif
#endif /* WMCONFIG_H_ */

View File

@@ -5,6 +5,7 @@
*
* This program is in the Public Domain.
*/
#include <config.h>
#include <X11/Xproto.h>
@@ -64,9 +65,6 @@ unsigned int black;
WMColor *cursorColor1;
WMColor *cursorColor2;
#ifndef __GNUC__
#define inline
#endif
static BufferData *makeBufferData(WMWindow * win, WMLabel * label, int width, int height, int magfactor)
{

View File

@@ -159,7 +159,7 @@ void RClearImage(RImage * image, const RColor * color)
}
}
static __inline__ unsigned char clip(int c)
static inline unsigned char clip(int c)
{
if (c > 255)
c = 255;