Skip to content

Refactor: Unify __inline and static inline function declarations #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/df/df.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static size_t regetmntinfo(struct statfs **, long);
static void update_maxwidths(struct maxwidths *, const struct statfs *);
static void usage(void);

static __inline int
static inline int
imax(int a, int b)
{
return (a > b ? a : b);
Expand Down
2 changes: 1 addition & 1 deletion cddl/compat/opensolaris/include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
extern "C" {
#endif

static __inline void
static inline void
__assert(const char *expr, const char *file, int line)
{

Expand Down
2 changes: 1 addition & 1 deletion cddl/compat/opensolaris/include/priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define PRIV_SYS_CONFIG 0

static __inline int
static inline int
priv_ineffect(int priv)
{

Expand Down
2 changes: 1 addition & 1 deletion cddl/contrib/opensolaris/head/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ typedef pthread_rwlock_t rwlock_t;
#define THR_SUSPENDED 0x00000080
#define THR_DAEMON 0x00000100

static __inline int
static inline int
thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*),
void *arg, long flags, thread_t *new_thread_ID)
{
Expand Down
22 changes: 11 additions & 11 deletions include/_ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ __END_DECLS
#ifdef _EXTERNALIZE_CTYPE_INLINES_
#define _USE_CTYPE_INLINE_
#define static
#define __inline
#define inline
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Redefining 'inline' globally may have unintended side-effects

This macro removes all 'inline' keywords in this header, which could affect other inline functions. Consider limiting its scope or undefining '__inline' instead to avoid interfering with unrelated code.

#endif

extern int __mb_sb_limit;
Expand All @@ -95,68 +95,68 @@ extern int __mb_sb_limit;

#include <runetype.h>

static __inline int
static inline int
__maskrune(__ct_rune_t _c, unsigned long _f)
{
return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) :
_CurrentRuneLocale->__runetype[_c]) & _f;
}

static __inline int
static inline int
__sbmaskrune(__ct_rune_t _c, unsigned long _f)
{
return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
_CurrentRuneLocale->__runetype[_c] & _f;
}

static __inline int
static inline int
__istype(__ct_rune_t _c, unsigned long _f)
{
return (!!__maskrune(_c, _f));
}

static __inline int
static inline int
__sbistype(__ct_rune_t _c, unsigned long _f)
{
return (!!__sbmaskrune(_c, _f));
}

static __inline int
static inline int
__isctype(__ct_rune_t _c, unsigned long _f)
{
return (_c < 0 || _c >= 128) ? 0 :
!!(_DefaultRuneLocale.__runetype[_c] & _f);
}

static __inline __ct_rune_t
static inline __ct_rune_t
__toupper(__ct_rune_t _c)
{
return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) :
_CurrentRuneLocale->__mapupper[_c];
}

static __inline __ct_rune_t
static inline __ct_rune_t
__sbtoupper(__ct_rune_t _c)
{
return (_c < 0 || _c >= __mb_sb_limit) ? _c :
_CurrentRuneLocale->__mapupper[_c];
}

static __inline __ct_rune_t
static inline __ct_rune_t
__tolower(__ct_rune_t _c)
{
return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) :
_CurrentRuneLocale->__maplower[_c];
}

static __inline __ct_rune_t
static inline __ct_rune_t
__sbtolower(__ct_rune_t _c)
{
return (_c < 0 || _c >= __mb_sb_limit) ? _c :
_CurrentRuneLocale->__maplower[_c];
}

static __inline int
static inline int
__wcwidth(__ct_rune_t _c)
{
unsigned int _x;
Expand Down
4 changes: 2 additions & 2 deletions include/rpc/xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ typedef bool_t (*xdrproc_t)(XDR *, ...);
#define xdr_putlong(xdrs, longp) \
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)

static __inline int
static inline int
xdr_getint32(XDR *xdrs, int32_t *ip)
{
long l;
Expand All @@ -171,7 +171,7 @@ xdr_getint32(XDR *xdrs, int32_t *ip)
return (TRUE);
}

static __inline int
static inline int
xdr_putint32(XDR *xdrs, int32_t *ip)
{
long l;
Expand Down
2 changes: 1 addition & 1 deletion include/runetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ extern const _RuneLocale *_CurrentRuneLocale;
extern const _RuneLocale *__getCurrentRuneLocale(void);
#else
extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
static __inline const _RuneLocale *__getCurrentRuneLocale(void)
static inline const _RuneLocale *__getCurrentRuneLocale(void)
{

if (_ThreadRuneLocale)
Expand Down
2 changes: 1 addition & 1 deletion include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ int __swbuf(int, FILE *);
*/
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__) && defined(__STDC__)
static __inline int __sputc(int _c, FILE *_p) {
static inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
Expand Down
4 changes: 2 additions & 2 deletions include/xlocale/_ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ _RuneLocale *__runes_for_locale(locale_t, int*);
#ifndef _XLOCALE_INLINE
#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
/* GNU89 inline has nonstandard semantics. */
#define _XLOCALE_INLINE extern __inline
#define _XLOCALE_INLINE extern inline
#else
/* Hack to work around people who define inline away */
#ifdef inline
#define _XLOCALE_INLINE static __inline
#define _XLOCALE_INLINE static inline
#else
/* Define with C++ / C99 compatible semantics */
#define _XLOCALE_INLINE inline
Expand Down
2 changes: 1 addition & 1 deletion kerberos5/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */

/* Define to `__inline__' or `__inline' if that's what the C compiler
/* Define to `inline__' or `inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
Expand Down
4 changes: 2 additions & 2 deletions libexec/rtld-elf/arm/reloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp, Elf_Addr relocbase)
#define RELOC_ALIGNED_P(x) \
(((uintptr_t)(x) & (sizeof(void *) - 1)) == 0)

static __inline Elf_Addr
static inline Elf_Addr
load_ptr(void *where)
{
Elf_Addr res;
Expand All @@ -125,7 +125,7 @@ load_ptr(void *where)
return (res);
}

static __inline void
static inline void
store_ptr(void *where, Elf_Addr val)
{

Expand Down
16 changes: 8 additions & 8 deletions sbin/ggate/shared/ggate.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,23 @@ in_addr_t g_gate_str2ip(const char *str);
* to big endian byte order).
*/

static __inline void
static inline void
g_gate_swap2h_version(struct g_gate_version *ver)
{

ver->gv_version = be16toh(ver->gv_version);
ver->gv_error = be16toh(ver->gv_error);
}

static __inline void
static inline void
g_gate_swap2n_version(struct g_gate_version *ver)
{

ver->gv_version = htobe16(ver->gv_version);
ver->gv_error = htobe16(ver->gv_error);
}

static __inline void
static inline void
g_gate_swap2h_cinit(struct g_gate_cinit *cinit)
{

Expand All @@ -144,7 +144,7 @@ g_gate_swap2h_cinit(struct g_gate_cinit *cinit)
cinit->gc_token = be32toh(cinit->gc_token);
}

static __inline void
static inline void
g_gate_swap2n_cinit(struct g_gate_cinit *cinit)
{

Expand All @@ -153,7 +153,7 @@ g_gate_swap2n_cinit(struct g_gate_cinit *cinit)
cinit->gc_token = htobe32(cinit->gc_token);
}

static __inline void
static inline void
g_gate_swap2h_sinit(struct g_gate_sinit *sinit)
{

Expand All @@ -163,7 +163,7 @@ g_gate_swap2h_sinit(struct g_gate_sinit *sinit)
sinit->gs_error = be16toh(sinit->gs_error);
}

static __inline void
static inline void
g_gate_swap2n_sinit(struct g_gate_sinit *sinit)
{

Expand All @@ -173,7 +173,7 @@ g_gate_swap2n_sinit(struct g_gate_sinit *sinit)
sinit->gs_error = htobe16(sinit->gs_error);
}

static __inline void
static inline void
g_gate_swap2h_hdr(struct g_gate_hdr *hdr)
{

Expand All @@ -184,7 +184,7 @@ g_gate_swap2h_hdr(struct g_gate_hdr *hdr)
hdr->gh_error = be16toh(hdr->gh_error);
}

static __inline void
static inline void
g_gate_swap2n_hdr(struct g_gate_hdr *hdr)
{

Expand Down
6 changes: 3 additions & 3 deletions sbin/hastd/activemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bitcount32(uint32_t x)
return (x);
}

static __inline int
static inline int
off2ext(const struct activemap *amp, off_t offset)
{
int extent;
Expand All @@ -104,7 +104,7 @@ off2ext(const struct activemap *amp, off_t offset)
return (extent);
}

static __inline off_t
static inline off_t
ext2off(const struct activemap *amp, int extent)
{
off_t offset;
Expand All @@ -119,7 +119,7 @@ ext2off(const struct activemap *amp, int extent)
* Function calculates number of requests needed to synchronize the given
* extent.
*/
static __inline int
static inline int
ext2reqs(const struct activemap *amp, int ext)
{
off_t left;
Expand Down
6 changes: 3 additions & 3 deletions sbin/hastd/refcnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@

typedef unsigned int refcnt_t;

static __inline void
static inline void
refcnt_init(refcnt_t *count, unsigned int v)
{

*count = v;
}

static __inline void
static inline void
refcnt_acquire(refcnt_t *count)
{

atomic_add_acq_int(count, 1);
}

static __inline unsigned int
static inline unsigned int
refcnt_release(refcnt_t *count)
{
unsigned int old;
Expand Down
Loading