Make mxs_mysql_get_command inline

This commit is contained in:
Johan Wikman
2017-10-06 13:44:32 +03:00
parent a51d23ded0
commit 87c01428be
2 changed files with 14 additions and 15 deletions

View File

@ -36,6 +36,7 @@
#include <sys/un.h> #include <sys/un.h>
#include <unistd.h> #include <unistd.h>
#include <maxscale/buffer.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/session.h> #include <maxscale/session.h>
#include <maxscale/version.h> #include <maxscale/version.h>
@ -591,7 +592,19 @@ void mxs_mysql_set_current_db(MXS_SESSION* session, const char* db);
* *
* @return The command byte * @return The command byte
*/ */
uint8_t mxs_mysql_get_command(GWBUF* buffer); static inline uint8_t mxs_mysql_get_command(GWBUF* buffer)
{
if (GWBUF_LENGTH(buffer) > MYSQL_HEADER_LEN)
{
return GWBUF_DATA(buffer)[4];
}
else
{
uint8_t command = 0;
gwbuf_copy_data(buffer, MYSQL_HEADER_LEN, 1, &command);
return command;
}
}
/** /**
* @brief Extract PS response values * @brief Extract PS response values

View File

@ -1616,20 +1616,6 @@ void mxs_mysql_set_current_db(MXS_SESSION* session, const char* db)
snprintf(data->db, sizeof(data->db), "%s", db); snprintf(data->db, sizeof(data->db), "%s", db);
} }
uint8_t mxs_mysql_get_command(GWBUF* buffer)
{
if (GWBUF_LENGTH(buffer) > MYSQL_HEADER_LEN)
{
return GWBUF_DATA(buffer)[4];
}
else
{
uint8_t command = 0;
gwbuf_copy_data(buffer, MYSQL_HEADER_LEN, 1, &command);
return command;
}
}
bool mxs_mysql_extract_ps_response(GWBUF* buffer, MXS_PS_RESPONSE* out) bool mxs_mysql_extract_ps_response(GWBUF* buffer, MXS_PS_RESPONSE* out)
{ {
bool rval = false; bool rval = false;