Prefix le[int|str]-functions with "mxs_"

This commit is contained in:
Johan Wikman 2016-12-29 10:10:11 +02:00
parent c008d794c7
commit b40872e600
7 changed files with 28 additions and 28 deletions

View File

@ -21,13 +21,13 @@
MXS_BEGIN_DECLS
/** Length-encoded integers */
size_t leint_bytes(const uint8_t* ptr);
uint64_t leint_value(const uint8_t* c);
uint64_t leint_consume(uint8_t ** c);
size_t mxs_leint_bytes(const uint8_t* ptr);
uint64_t mxs_leint_value(const uint8_t* c);
uint64_t mxs_leint_consume(uint8_t ** c);
/** Length-encoded strings */
char* lestr_consume_dup(uint8_t** c);
char* lestr_consume(uint8_t** c, size_t *size);
char* mxs_lestr_consume_dup(uint8_t** c);
char* mxs_lestr_consume(uint8_t** c, size_t *size);
MYSQL *mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd);

View File

@ -30,7 +30,7 @@
*
* @param type The table column type
* @return The type of the column in human readable format
* @see lestr_consume
* @see mxs_lestr_consume
*/
const char* column_type_to_string(uint8_t type)
{
@ -120,7 +120,7 @@ bool column_is_blob(uint8_t type)
*
* @param type Type of the column
* @return True if the column is a string type column
* @see lestr_consume
* @see mxs_lestr_consume
*/
bool column_is_variable_string(uint8_t type)
{
@ -175,7 +175,7 @@ bool column_is_temporal(uint8_t type)
*
* @param type Type of the column
* @return True if the column is a string type column
* @see lestr_consume
* @see mxs_lestr_consume
*/
bool column_is_fixed_string(uint8_t type)
{

View File

@ -34,7 +34,7 @@
* @param ptr Start of the length encoded value
* @return Number of bytes before the actual value
*/
size_t leint_bytes(const uint8_t* ptr)
size_t mxs_leint_bytes(const uint8_t* ptr)
{
uint8_t val = *ptr;
if (val < 0xfb)
@ -62,7 +62,7 @@ size_t leint_bytes(const uint8_t* ptr)
* @param c Pointer to the first byte of a length-encoded integer
* @return The value converted to a standard unsigned integer
*/
uint64_t leint_value(const uint8_t* c)
uint64_t mxs_leint_value(const uint8_t* c)
{
uint64_t sz = 0;
@ -98,10 +98,10 @@ uint64_t leint_value(const uint8_t* c)
*
* @param c Pointer to the first byte of a length-encoded integer
*/
uint64_t leint_consume(uint8_t ** c)
uint64_t mxs_leint_consume(uint8_t ** c)
{
uint64_t rval = leint_value(*c);
*c += leint_bytes(*c);
uint64_t rval = mxs_leint_value(*c);
*c += mxs_leint_bytes(*c);
return rval;
}
@ -114,9 +114,9 @@ uint64_t leint_consume(uint8_t ** c)
* @param c Pointer to the first byte of a valid packet.
* @return The newly allocated string or NULL if memory allocation failed
*/
char* lestr_consume_dup(uint8_t** c)
char* mxs_lestr_consume_dup(uint8_t** c)
{
uint64_t slen = leint_consume(c);
uint64_t slen = mxs_leint_consume(c);
char *str = MXS_MALLOC((slen + 1) * sizeof(char));
if (str)
@ -138,9 +138,9 @@ char* lestr_consume_dup(uint8_t** c)
* @param size Pointer to a variable where the size of the string is stored
* @return Pointer to the start of the string
*/
char* lestr_consume(uint8_t** c, size_t *size)
char* mxs_lestr_consume(uint8_t** c, size_t *size)
{
uint64_t slen = leint_consume(c);
uint64_t slen = mxs_leint_consume(c);
*size = slen;
char* start = (char*) *c;
*c += slen;

View File

@ -425,9 +425,9 @@ int CacheFilterSession::handle_expecting_response()
}
else
{
// leint_bytes() returns the length of the int type field + the size of the
// mxs_leint_bytes() returns the length of the int type field + the size of the
// integer.
size_t n_bytes = leint_bytes(&header[4]);
size_t n_bytes = mxs_leint_bytes(&header[4]);
if (MYSQL_HEADER_LEN + n_bytes <= buflen)
{
@ -436,7 +436,7 @@ int CacheFilterSession::handle_expecting_response()
gwbuf_copy_data(m_res.pData,
MYSQL_HEADER_LEN + 1, n_bytes - 1, &header[MYSQL_HEADER_LEN + 1]);
m_res.nTotalFields = leint_value(&header[4]);
m_res.nTotalFields = mxs_leint_value(&header[4]);
m_res.offset = MYSQL_HEADER_LEN + n_bytes;
m_state = CACHE_EXPECTING_FIELDS;

View File

@ -632,9 +632,9 @@ static int handle_expecting_response(MAXROWS_SESSION_DATA *csdata)
}
else
{
// leint_bytes() returns the length of the int type field + the size of the
// mxs_leint_bytes() returns the length of the int type field + the size of the
// integer.
size_t n_bytes = leint_bytes(&header[4]);
size_t n_bytes = mxs_leint_bytes(&header[4]);
if (MYSQL_HEADER_LEN + n_bytes <= buflen)
{
@ -643,7 +643,7 @@ static int handle_expecting_response(MAXROWS_SESSION_DATA *csdata)
gwbuf_copy_data(csdata->res.data,
MYSQL_HEADER_LEN + 1, n_bytes - 1, &header[MYSQL_HEADER_LEN + 1]);
csdata->res.n_totalfields = leint_value(&header[4]);
csdata->res.n_totalfields = mxs_leint_value(&header[4]);
csdata->res.offset += MYSQL_HEADER_LEN + n_bytes;
csdata->state = MAXROWS_EXPECTING_FIELDS;

View File

@ -247,7 +247,7 @@ bool handle_row_event(AVRO_INSTANCE *router, REP_HEADER *hdr, uint8_t *ptr)
}
/** Number of columns in the table */
uint64_t ncolumns = leint_consume(&ptr);
uint64_t ncolumns = mxs_leint_consume(&ptr);
/** If full row image is used, all columns are present. Currently only full
* row image is supported and thus the bitfield should be all ones. In
@ -546,7 +546,7 @@ uint8_t* process_row_event_data(TABLE_MAP *map, TABLE_CREATE *create, avro_value
else if (column_is_variable_string(map->column_types[i]))
{
size_t sz;
char *str = lestr_consume(&ptr, &sz);
char *str = mxs_lestr_consume(&ptr, &sz);
char buf[sz + 1];
memcpy(buf, str, sz);
buf[sz] = '\0';

View File

@ -952,15 +952,15 @@ TABLE_MAP *table_map_alloc(uint8_t *ptr, uint8_t hdr_len, TABLE_CREATE* create)
memcpy(table_name, ptr, table_name_len + 1);
ptr += table_name_len + 1;
uint64_t column_count = leint_value(ptr);
ptr += leint_bytes(ptr);
uint64_t column_count = mxs_leint_value(ptr);
ptr += mxs_leint_bytes(ptr);
/** Column types */
uint8_t *column_types = ptr;
ptr += column_count;
size_t metadata_size = 0;
uint8_t* metadata = (uint8_t*)lestr_consume(&ptr, &metadata_size);
uint8_t* metadata = (uint8_t*)mxs_lestr_consume(&ptr, &metadata_size);
uint8_t *nullmap = ptr;
size_t nullmap_size = (column_count + 7) / 8;
TABLE_MAP *map = MXS_MALLOC(sizeof(TABLE_MAP));