Change defines into inline functions

To prevent bugs caused by pointers having the wrong type (e.g. uint32_t
instead of uint8_t), some macros are changed into inline functions so that
the normal type-checking is performed.

The macros MYSQL_GET_ERRCODE, MYSQL_GET_STMTOK_NPARAM, MYSQL_GET_STMTOK_NATTR,
and MYSQL_GET_NATTR were not changed, because they may be too specific to
be present in a general purpose header in the first place.
This commit is contained in:
Johan Wikman
2016-11-23 09:55:35 +02:00
parent dcd98900ea
commit 83ffdcf4ed
2 changed files with 40 additions and 19 deletions

View File

@ -58,6 +58,11 @@
#include <maxscale/debug.h>
#include <maxscale/log_manager.h>
#include <maxscale/query_classifier.h>
// <maxscale/protocol/mysql.h> assumes it is being compiled agains Connector-C,
// so we need to make certain Connector-C constants visible.
#define MYSQL_COM_QUIT COM_QUIT
#define MYSQL_COM_INIT_DB COM_INIT_DB
#define MYSQL_COM_CHANGE_USER COM_CHANGE_USER
#include <maxscale/protocol/mysql.h>
#include <maxscale/gwdirs.h>