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