Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed Apr 24, 2017
2 parents 530396c + 5a759d3 commit 79ecd75
Show file tree
Hide file tree
Showing 255 changed files with 4,859 additions and 4,047 deletions.
2 changes: 1 addition & 1 deletion client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ static void make_error_message(char *buf, size_t len, const char *fmt, va_list a
fmt= "unknown error";

s+= my_vsnprintf(s, end - s, fmt, args);
s+= my_snprintf(s, end -s, "\n", start_lineno);
s+= my_snprintf(s, end -s, "\n");
}

void die(const char *fmt, ...)
Expand Down
13 changes: 4 additions & 9 deletions include/m_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))

struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string LEX_CSTRING;

/* A variant with const and unsigned */
Expand All @@ -227,15 +222,15 @@ struct st_mysql_const_unsigned_lex_string
};
typedef struct st_mysql_const_unsigned_lex_string LEX_CUSTRING;

static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
static inline void lex_string_set(LEX_CSTRING *lex_str, const char *c_str)
{
lex_str->str= (char *) c_str;
lex_str->str= c_str;
lex_str->length= strlen(c_str);
}
static inline void lex_string_set3(LEX_STRING *lex_str, const char *c_str,
static inline void lex_string_set3(LEX_CSTRING *lex_str, const char *c_str,
size_t len)
{
lex_str->str= (char *) c_str;
lex_str->str= c_str;
lex_str->length= len;
}

Expand Down
2 changes: 2 additions & 0 deletions include/my_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
}

/* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */
#ifndef ER_WARN_DATA_OUT_OF_RANGE
#define ER_WARN_DATA_OUT_OF_RANGE 1264
#define ER_WARN_INVALID_TIMESTAMP 1299
#endif

my_time_t
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code);
Expand Down
2 changes: 1 addition & 1 deletion include/mysql.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
char **args;
unsigned long *lengths;
char *maybe_null;
char **attributes;
const char **attributes;
unsigned long *attribute_lengths;
void *extension;
} UDF_ARGS;
Expand Down
19 changes: 14 additions & 5 deletions include/mysql/plugin_audit.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
;
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
Expand Down Expand Up @@ -233,23 +234,31 @@
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
MYSQL_CONST_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
MYSQL_CONST_LEX_STRING
*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/plugin_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef struct st_mysql_server_auth_info
User name as sent by the client and shown in USER().
NULL if the client packet with the user name was not received yet.
*/
char *user_name;
const char *user_name;

/**
Length of user_name
Expand Down
21 changes: 15 additions & 6 deletions include/mysql/plugin_auth.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
;
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
Expand Down Expand Up @@ -233,23 +234,31 @@
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
MYSQL_CONST_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
MYSQL_CONST_LEX_STRING
*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
Expand Down Expand Up @@ -501,7 +510,7 @@
} MYSQL_PLUGIN_VIO;
typedef struct st_mysql_server_auth_info
{
char *user_name;
const char *user_name;
unsigned int user_name_length;
const char *auth_string;
unsigned long auth_string_length;
Expand Down
19 changes: 14 additions & 5 deletions include/mysql/plugin_encryption.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
;
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
Expand Down Expand Up @@ -233,23 +234,31 @@
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
MYSQL_CONST_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
MYSQL_CONST_LEX_STRING
*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
Expand Down
19 changes: 14 additions & 5 deletions include/mysql/plugin_ftparser.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
;
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
Expand Down Expand Up @@ -233,23 +234,31 @@
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
MYSQL_CONST_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
MYSQL_CONST_LEX_STRING
*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
Expand Down
4 changes: 2 additions & 2 deletions include/mysql/plugin_password_validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ struct st_mariadb_password_validation
Function provided by the plugin which should perform password validation
and return 0 if the password has passed the validation.
*/
int (*validate_password)(MYSQL_LEX_STRING *username,
MYSQL_LEX_STRING *password);
int (*validate_password)(MYSQL_CONST_LEX_STRING *username,
MYSQL_CONST_LEX_STRING *password);
};

#ifdef __cplusplus
Expand Down
23 changes: 16 additions & 7 deletions include/mysql/plugin_password_validation.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
;
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
Expand Down Expand Up @@ -233,23 +234,31 @@
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(void*,
MYSQL_CONST_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
MYSQL_CONST_LEX_STRING
*thd_make_lex_string(void* thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
Expand Down Expand Up @@ -487,6 +496,6 @@
struct st_mariadb_password_validation
{
int interface_version;
int (*validate_password)(MYSQL_LEX_STRING *username,
MYSQL_LEX_STRING *password);
int (*validate_password)(MYSQL_CONST_LEX_STRING *username,
MYSQL_CONST_LEX_STRING *password);
};
15 changes: 14 additions & 1 deletion include/mysql/service_my_snprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,22 @@ extern struct my_snprintf_service_st {

#else

size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
#ifndef ATTRIBUTE_FORMAT
#define ATTRIBUTE_FORMAT_DEFINED
#define ATTRIBUTE_FORMAT(A,B,C)
#endif
#ifdef MYSQL_ABI_CHECK
#undef ATTRIBUTE_FORMAT
#define ATTRIBUTE_FORMAT(A,B,C)
#endif
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);

#ifdef ATTRIBUTE_FORMAT_DEFINED
#undef ATTRIBUTE_FORMAT_DEFINED
#undef ATTRIBUTE_FORMAT
#endif
#endif

#ifdef __cplusplus
Expand Down
17 changes: 13 additions & 4 deletions include/mysql/service_thd_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,21 @@ struct st_mysql_lex_string
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;

struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;

extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(MYSQL_THD, unsigned int);
void *(*thd_calloc_func)(MYSQL_THD, unsigned int);
char *(*thd_strdup_func)(MYSQL_THD, const char *);
char *(*thd_strmake_func)(MYSQL_THD, const char *, unsigned int);
void *(*thd_memdup_func)(MYSQL_THD, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *,
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD,
MYSQL_CONST_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;

Expand Down Expand Up @@ -115,9 +123,10 @@ void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
@see thd_alloc()
*/
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
MYSQL_CONST_LEX_STRING
*thd_make_lex_string(MYSQL_THD thd, MYSQL_CONST_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);

#endif

Expand Down
2 changes: 1 addition & 1 deletion include/mysql_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ typedef struct st_udf_args
char **args; /* Pointer to argument */
unsigned long *lengths; /* Length of string arguments */
char *maybe_null; /* Set to 1 for all maybe_null args */
char **attributes; /* Pointer to attribute name */
const char **attributes; /* Pointer to attribute name */
unsigned long *attribute_lengths; /* Length of attribute arguments */
void *extension;
} UDF_ARGS;
Expand Down
Loading

0 comments on commit 79ecd75

Please sign in to comment.