Skip to content

Commit

Permalink
tree: Remove "inline" function attributes
Browse files Browse the repository at this point in the history
Remove "inline" function attributes and leave the decision to the
compiler.

Note: We keep "inline" in the cleanup functions in mx_util.h to avoid
conflicts between instances of the functions bodies in multiple
compilation units.
  • Loading branch information
donald committed Feb 21, 2022
1 parent e58f37c commit 76a8287
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
6 changes: 3 additions & 3 deletions mx_flock.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# define mx_free_null(a) do { free((a)); (a) = NULL; } while(0)
#endif

static inline int _flock_open(struct mx_flock *lock, mode_t mode)
static int _flock_open(struct mx_flock *lock, mode_t mode)
{
int fd;

Expand All @@ -39,7 +39,7 @@ static inline int _flock_open(struct mx_flock *lock, mode_t mode)
return fd;
}

static inline int _flock_close(struct mx_flock *lock)
static int _flock_close(struct mx_flock *lock)
{
int res;

Expand All @@ -53,7 +53,7 @@ static inline int _flock_close(struct mx_flock *lock)
return res;
}

static inline void _flock_free(struct mx_flock *lock)
static void _flock_free(struct mx_flock *lock)
{
if (!lock)
return;
Expand Down
52 changes: 26 additions & 26 deletions mx_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

/**********************************************************************/

static inline int mx__mysql_errno(struct mx_mysql *mysql)
static int mx__mysql_errno(struct mx_mysql *mysql)
{
unsigned int error;

Expand All @@ -62,7 +62,7 @@ static inline int mx__mysql_errno(struct mx_mysql *mysql)
return (int)error;
}

extern inline const char *mx__mysql_error(struct mx_mysql *mysql)
extern const char *mx__mysql_error(struct mx_mysql *mysql)
{
mx_assert_return_NULL(mysql, EINVAL);
mx_assert_return_NULL(mysql->mysql, EBADF);
Expand All @@ -71,7 +71,7 @@ extern inline const char *mx__mysql_error(struct mx_mysql *mysql)
return mysql_error(mysql->mysql);
}

extern inline const char *mx__mysql_sqlstate(struct mx_mysql *mysql)
extern const char *mx__mysql_sqlstate(struct mx_mysql *mysql)
{
mx_assert_return_NULL(mysql, EINVAL);
mx_assert_return_NULL(mysql->mysql, EBADF);
Expand All @@ -80,7 +80,7 @@ extern inline const char *mx__mysql_sqlstate(struct mx_mysql *mysql)
return mysql_sqlstate(mysql->mysql);
}

static inline int mx__mysql_stmt_errno(struct mx_mysql_stmt *stmt)
static int mx__mysql_stmt_errno(struct mx_mysql_stmt *stmt)
{
unsigned int error;

Expand All @@ -94,7 +94,7 @@ static inline int mx__mysql_stmt_errno(struct mx_mysql_stmt *stmt)
return (int)error;
}

static inline const char *mx__mysql_stmt_error(struct mx_mysql_stmt *stmt)
static const char *mx__mysql_stmt_error(struct mx_mysql_stmt *stmt)
{
mx_assert_return_NULL(stmt, EINVAL);
mx_assert_return_NULL(stmt->stmt, EBADF);
Expand All @@ -103,7 +103,7 @@ static inline const char *mx__mysql_stmt_error(struct mx_mysql_stmt *stmt)
return mysql_stmt_error(stmt->stmt);
}

static inline const char *mx__mysql_stmt_sqlstate(struct mx_mysql_stmt *stmt)
static const char *mx__mysql_stmt_sqlstate(struct mx_mysql_stmt *stmt)
{
mx_assert_return_NULL(stmt, EINVAL);
mx_assert_return_NULL(stmt->stmt, EBADF);
Expand All @@ -112,7 +112,7 @@ static inline const char *mx__mysql_stmt_sqlstate(struct mx_mysql_stmt *stmt)
return mysql_stmt_sqlstate(stmt->stmt);
}

static inline int mx__mysql_init(struct mx_mysql *mysql)
static int mx__mysql_init(struct mx_mysql *mysql)
{
mx_assert_return_minus_errno(mysql, EINVAL);
mx_assert_return_minus_errno(!mysql->mysql, EUCLEAN);
Expand All @@ -129,7 +129,7 @@ static inline int mx__mysql_init(struct mx_mysql *mysql)
return -errno;
}

static inline int mx__mysql_options(struct mx_mysql *mysql, enum mysql_option option, const void *arg)
static int mx__mysql_options(struct mx_mysql *mysql, enum mysql_option option, const void *arg)
{
int res;

Expand Down Expand Up @@ -189,7 +189,7 @@ static int mx__mysql_real_connect(struct mx_mysql *mysql, const char *host, cons
return -(errno=EBADE);
}

static inline int mx__mysql_ping(struct mx_mysql *mysql)
static int mx__mysql_ping(struct mx_mysql *mysql)
{
mx_assert_return_minus_errno(mysql, EINVAL);
mx_assert_return_minus_errno(mysql->mysql, EBADF);
Expand Down Expand Up @@ -688,7 +688,7 @@ static int mx__mysql_library_end(void) {

/**********************************************************************/

extern inline int _mx_mysql_bind_integer(struct mx_mysql_bind *b, unsigned int index, void *value, int type, int is_unsigned)
extern int _mx_mysql_bind_integer(struct mx_mysql_bind *b, unsigned int index, void *value, int type, int is_unsigned)
{
mx_assert_return_minus_errno(b, EINVAL);
mx_assert_return_minus_errno(value, EINVAL);
Expand Down Expand Up @@ -747,7 +747,7 @@ void _mx_mysql_bind_dump(struct mx_mysql_bind *b)
}


static inline int _mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, char **value)
static int _mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, char **value)
{
mx_assert_return_minus_errno(b, EINVAL);
mx_assert_return_minus_errno(value, EINVAL);
Expand Down Expand Up @@ -786,7 +786,7 @@ static inline int _mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int in
return 0;
}

static inline int _mx_mysql_bind_validate(struct mx_mysql_bind *b)
static int _mx_mysql_bind_validate(struct mx_mysql_bind *b)
{
int i;

Expand Down Expand Up @@ -1230,7 +1230,7 @@ int mx_mysql_statement_field_count(struct mx_mysql_stmt *stmt)
return mx__mysql_stmt_field_count(stmt);
}

extern inline int mx_mysql_stmt_field_count_set(struct mx_mysql_stmt *stmt)
extern int mx_mysql_stmt_field_count_set(struct mx_mysql_stmt *stmt)
{
mx_assert_return_minus_errno(stmt, EINVAL);
mx_assert_return_minus_errno(stmt->stmt, EBADF);
Expand All @@ -1240,7 +1240,7 @@ extern inline int mx_mysql_stmt_field_count_set(struct mx_mysql_stmt *stmt)
return 0;
}

inline int mx_mysql_stmt_field_count_get(struct mx_mysql_stmt *stmt, unsigned long *count)
int mx_mysql_stmt_field_count_get(struct mx_mysql_stmt *stmt, unsigned long *count)
{
mx_assert_return_minus_errno(stmt, EINVAL);
mx_assert_return_minus_errno(count, EINVAL);
Expand All @@ -1251,7 +1251,7 @@ inline int mx_mysql_stmt_field_count_get(struct mx_mysql_stmt *stmt, unsigned lo
return 0;
}

extern inline int mx_mysql_stmt_param_count_set(struct mx_mysql_stmt *stmt)
extern int mx_mysql_stmt_param_count_set(struct mx_mysql_stmt *stmt)
{
mx_assert_return_minus_errno(stmt, EINVAL);
mx_assert_return_minus_errno(stmt->stmt, EBADF);
Expand All @@ -1261,7 +1261,7 @@ extern inline int mx_mysql_stmt_param_count_set(struct mx_mysql_stmt *stmt)
return 0;
}

inline int mx_mysql_stmt_param_count_get(struct mx_mysql_stmt *stmt, unsigned long *count)
int mx_mysql_stmt_param_count_get(struct mx_mysql_stmt *stmt, unsigned long *count)
{
mx_assert_return_minus_errno(stmt, EINVAL);
mx_assert_return_minus_errno(count, EINVAL);
Expand Down Expand Up @@ -1502,7 +1502,7 @@ int mx_mysql_statement_close_no_bind_cleanup(struct mx_mysql_stmt **stmt)
return 0;
}

extern inline int mx_mysql_bind_integer(struct mx_mysql_bind *b, unsigned int index, void *value, int type, int is_unsigned)
extern int mx_mysql_bind_integer(struct mx_mysql_bind *b, unsigned int index, void *value, int type, int is_unsigned)
{
int res;

Expand All @@ -1514,7 +1514,7 @@ extern inline int mx_mysql_bind_integer(struct mx_mysql_bind *b, unsigned int in
return res;
}

inline int mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, char **value)
int mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, char **value)
{
int res;

Expand All @@ -1527,42 +1527,42 @@ inline int mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, cha

}

inline int mx_mysql_bind_int8(struct mx_mysql_bind *b, unsigned int index, int8_t *value)
int mx_mysql_bind_int8(struct mx_mysql_bind *b, unsigned int index, int8_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_TINY, 0);
}

inline int mx_mysql_bind_uint8(struct mx_mysql_bind *b, unsigned int index, uint8_t *value)
int mx_mysql_bind_uint8(struct mx_mysql_bind *b, unsigned int index, uint8_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_TINY, 1);
}

inline int mx_mysql_bind_int16(struct mx_mysql_bind *b, unsigned int index, int16_t *value)
int mx_mysql_bind_int16(struct mx_mysql_bind *b, unsigned int index, int16_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_SHORT, 0);
}

inline int mx_mysql_bind_uint16(struct mx_mysql_bind *b, unsigned int index, uint16_t *value)
int mx_mysql_bind_uint16(struct mx_mysql_bind *b, unsigned int index, uint16_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_SHORT, 1);
}

inline int mx_mysql_bind_int32(struct mx_mysql_bind *b, unsigned int index, int32_t *value)
int mx_mysql_bind_int32(struct mx_mysql_bind *b, unsigned int index, int32_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_LONG, 0);
}

inline int mx_mysql_bind_uint32(struct mx_mysql_bind *b, unsigned int index, uint32_t *value)
int mx_mysql_bind_uint32(struct mx_mysql_bind *b, unsigned int index, uint32_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_LONG, 1);
}

inline int mx_mysql_bind_int64(struct mx_mysql_bind *b, unsigned int index, int64_t *value)
int mx_mysql_bind_int64(struct mx_mysql_bind *b, unsigned int index, int64_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_LONGLONG, 0);
}

inline int mx_mysql_bind_uint64(struct mx_mysql_bind *b, unsigned int index, uint64_t *value)
int mx_mysql_bind_uint64(struct mx_mysql_bind *b, unsigned int index, uint64_t *value)
{
return mx_mysql_bind_integer(b, index, (void *)value, MYSQL_TYPE_LONGLONG, 1);
}
26 changes: 13 additions & 13 deletions mx_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "mx_log.h"
#include "mx_util.h"

static inline int _mx_strbeginswith(char *str, const char *start, char **endptr, short ignore_case)
static int _mx_strbeginswith(char *str, const char *start, char **endptr, short ignore_case)
{
size_t len;
int res;
Expand All @@ -42,17 +42,17 @@ static inline int _mx_strbeginswith(char *str, const char *start, char **endptr,
return 1;
}

inline int mx_strbeginswith(char *str, const char *start, char **endptr)
int mx_strbeginswith(char *str, const char *start, char **endptr)
{
return _mx_strbeginswith(str, start, endptr, 0);
}

inline int mx_stribeginswith(char *str, const char *start, char **endptr)
int mx_stribeginswith(char *str, const char *start, char **endptr)
{
return _mx_strbeginswith(str, start, endptr, 1);
}

static inline int _mx_strbeginswithany(char *str, char **starts, char **endptr, short ignore_case)
static int _mx_strbeginswithany(char *str, char **starts, char **endptr, short ignore_case)
{
char **s;
char *end;
Expand All @@ -73,7 +73,7 @@ static inline int _mx_strbeginswithany(char *str, char **starts, char **endptr,
return 0;
}

inline int mx_strbeginswithany(char *str, char **starts, char **endptr)
int mx_strbeginswithany(char *str, char **starts, char **endptr)
{
return _mx_strbeginswithany(str, starts, endptr, 0);
}
Expand All @@ -83,7 +83,7 @@ int mx_stribeginswithany(char *str, char **starts, char **endptr)
return _mx_strbeginswithany(str, starts, endptr, 1);
}

inline int mx_strtobytes(char *str, unsigned long long int *bytes)
int mx_strtobytes(char *str, unsigned long long int *bytes)
{
unsigned long long int s = 0;
unsigned long long int t;
Expand Down Expand Up @@ -149,7 +149,7 @@ inline int mx_strtobytes(char *str, unsigned long long int *bytes)
return 0;
}

inline int mx_strtoseconds(char *str, unsigned long long int *seconds)
int mx_strtoseconds(char *str, unsigned long long int *seconds)
{
unsigned long long int s = 0;
unsigned long long int t;
Expand Down Expand Up @@ -219,7 +219,7 @@ inline int mx_strtoseconds(char *str, unsigned long long int *seconds)
return 0;
}

inline int mx_strtominutes(char *str, unsigned long long int *minutes)
int mx_strtominutes(char *str, unsigned long long int *minutes)
{
int res;

Expand All @@ -231,7 +231,7 @@ inline int mx_strtominutes(char *str, unsigned long long int *minutes)
return res;
}

inline char *mx_strskipwhitespaces(char *str)
char *mx_strskipwhitespaces(char *str)
{
char *s;

Expand All @@ -245,7 +245,7 @@ inline char *mx_strskipwhitespaces(char *str)

/* wrapper unsigned */

inline int mx_strtoul(char *str, unsigned long int *to)
int mx_strtoul(char *str, unsigned long int *to)
{
unsigned long int ul;
char *end;
Expand Down Expand Up @@ -273,7 +273,7 @@ inline int mx_strtoul(char *str, unsigned long int *to)
return 0;
}

inline int mx_strtoull(char *str, unsigned long long int *to)
int mx_strtoull(char *str, unsigned long long int *to)
{
unsigned long long int ull;
char *end;
Expand Down Expand Up @@ -303,7 +303,7 @@ inline int mx_strtoull(char *str, unsigned long long int *to)

/* wrapper signed */

inline int mx_strtol(char *str, signed long int *to)
int mx_strtol(char *str, signed long int *to)
{
long int l;
char *end;
Expand All @@ -328,7 +328,7 @@ inline int mx_strtol(char *str, signed long int *to)
return 0;
}

inline int mx_strtoll(char *str, signed long long int *to)
int mx_strtoll(char *str, signed long long int *to)
{
long long int ll;
char *end;
Expand Down
6 changes: 3 additions & 3 deletions mxq_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void mxq_group_free_content(struct mxq_group *g)
}


extern inline uint64_t mxq_group_jobs_done(struct mxq_group *g)
extern uint64_t mxq_group_jobs_done(struct mxq_group *g)
{
uint64_t done = 0;

Expand All @@ -138,7 +138,7 @@ extern inline uint64_t mxq_group_jobs_done(struct mxq_group *g)
return done;
}

extern inline uint64_t mxq_group_jobs_active(struct mxq_group *g)
extern uint64_t mxq_group_jobs_active(struct mxq_group *g)
{
uint64_t active;

Expand All @@ -152,7 +152,7 @@ extern inline uint64_t mxq_group_jobs_active(struct mxq_group *g)
return active;
}

extern inline uint64_t mxq_group_jobs_inq(struct mxq_group *g)
extern uint64_t mxq_group_jobs_inq(struct mxq_group *g)
{
uint64_t inq;

Expand Down

0 comments on commit 76a8287

Please sign in to comment.