Remove dependency on skygw_utils.h

- STRERROR_BUFLEN moved to cdefs.h and renamed to MXS_STRERROR_BUFLEN.
  Better would be to provide a 'const char* mxs_strerror(int errno)'
  that would have a thread specific buffer for the error message.
- MIN and MAX also moved to defs.h as MXS_MIN and MXS_MAX.
- Now only mlist.h of the headers depend upon skygw_utils.h.
This commit is contained in:
Johan Wikman
2016-10-14 15:38:16 +03:00
parent bff2cfb7e5
commit 03dbc6df80
51 changed files with 215 additions and 199 deletions

View File

@ -35,4 +35,42 @@
# define MXS_END_DECLS
#endif
/**
* Define intended for use with strerror.
*
* char errbuf[MXS_STRERROR_BUFLEN];
* strerror_r(errno, errbuf, sizeof(errbuf))
*/
#define MXS_STRERROR_BUFLEN 512
/**
* Returns the smaller of two items.
*
* @param a A value.
* @param b Another value.
*
* @return a if a is smaller than b, b otherwise.
*
* @note This a macro, so the arguments will be evaluated more than once.
*/
#define MXS_MIN(a,b) ((a)<(b) ? (a) : (b))
/**
* Returns the larger of two items.
*
* @param a A value.
* @param b Another value.
*
* @return a if a is larger than b, b otherwise.
*
* @note This a macro, so the arguments will be evaluated more than once.
*/
#define MXS_MAX(a,b) ((a)>(b) ? (a) : (b))
/**
* COMMON INCLUDE FILES
*/
#include <stdbool.h>
#include <stddef.h>
#endif

View File

@ -31,7 +31,6 @@
*/
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h>
#include <sys/utsname.h>
#include <stdint.h>
#include <openssl/sha.h>

View File

@ -56,7 +56,6 @@
#include <maxscale/gw_ssl.h>
#include <maxscale/modinfo.h>
#include <maxscale/gwbitmask.h>
#include <maxscale/skygw_utils.h>
#include <netinet/in.h>
MXS_BEGIN_DECLS

View File

@ -18,7 +18,6 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <maxscale/skygw_utils.h>
#include <maxscale/log_manager.h>
#include <maxscale/pcre2.h>

View File

@ -20,7 +20,6 @@
#include <maxscale/cdefs.h>
#include <stdlib.h>
#include <string.h>
#include <maxscale/skygw_utils.h>
MXS_BEGIN_DECLS

View File

@ -21,13 +21,6 @@
MXS_BEGIN_DECLS
/*
* We need a common.h file that is included by every component.
*/
#if !defined(STRERROR_BUFLEN)
#define STRERROR_BUFLEN 512
#endif
/**
* If MXS_MODULE_NAME is defined before log_manager.h is included, then all
* logged messages will be prefixed with that string enclosed in square brackets.

View File

@ -15,7 +15,6 @@
*/
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h>
#include <maxscale/buffer.h>
MXS_BEGIN_DECLS

View File

@ -42,7 +42,6 @@
#include <maxscale/listmanager.h>
#include <maxscale/spinlock.h>
#include <maxscale/resultset.h>
#include <maxscale/skygw_utils.h>
#include <maxscale/log_manager.h>
MXS_BEGIN_DECLS

View File

@ -18,19 +18,6 @@
MXS_BEGIN_DECLS
/*
* We need a common.h file that is included by every component.
*/
#if !defined(STRERROR_BUFLEN)
#define STRERROR_BUFLEN 512
#endif
#ifndef MIN
#define MIN(a,b) (a<b ? a : b)
#endif
#ifndef MAX
#define MAX(a,b) (a>b ? a : b)
#endif
#define FSYNCLIMIT 10
#include <maxscale/debug.h>

View File

@ -15,7 +15,7 @@
*/
#include <maxscale/cdefs.h>
#include <maxscale/skygw_utils.h>
#include <maxscale/debug.h>
MXS_BEGIN_DECLS