mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
InnoDB: simplify innobase_compression_algorithm_validate()
This commit is contained in:
parent
8815fb3d45
commit
e5989d52a7
2 changed files with 6 additions and 50 deletions
|
@ -20033,33 +20033,11 @@ innodb_compression_algorithm_validate(
|
|||
long compression_algorithm;
|
||||
DBUG_ENTER("innobase_compression_algorithm_validate");
|
||||
|
||||
if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) {
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
const char *str;
|
||||
int length= sizeof(buff);
|
||||
|
||||
if (!(str= value->val_str(value, buff, &length))) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if ((compression_algorithm= (long)find_type(str, &page_compression_algorithms_typelib, 0) - 1) < 0) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
} else {
|
||||
long long tmp;
|
||||
|
||||
if (value->val_int(value, &tmp)) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if (tmp < 0 || tmp >= page_compression_algorithms_typelib.count) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
compression_algorithm= (long) tmp;
|
||||
if (check_sysvar_enum(thd, var, save, value)) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
*reinterpret_cast<ulong*>(save) = compression_algorithm;
|
||||
compression_algorithm = *reinterpret_cast<ulong*>(save);
|
||||
|
||||
#ifndef HAVE_LZ4
|
||||
if (compression_algorithm == PAGE_LZ4_ALGORITHM) {
|
||||
|
|
|
@ -21261,33 +21261,11 @@ innodb_compression_algorithm_validate(
|
|||
long compression_algorithm;
|
||||
DBUG_ENTER("innobase_compression_algorithm_validate");
|
||||
|
||||
if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) {
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
const char *str;
|
||||
int length= sizeof(buff);
|
||||
|
||||
if (!(str= value->val_str(value, buff, &length))) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if ((compression_algorithm= (long)find_type(str, &page_compression_algorithms_typelib, 0) - 1) < 0) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
} else {
|
||||
long long tmp;
|
||||
|
||||
if (value->val_int(value, &tmp)) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if (tmp < 0 || tmp >= page_compression_algorithms_typelib.count) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
compression_algorithm= (long) tmp;
|
||||
if (check_sysvar_enum(thd, var, save, value)) {
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
*reinterpret_cast<ulong*>(save) = compression_algorithm;
|
||||
compression_algorithm = *reinterpret_cast<ulong*>(save);
|
||||
|
||||
#ifndef HAVE_LZ4
|
||||
if (compression_algorithm == PAGE_LZ4_ALGORITHM) {
|
||||
|
|
Loading…
Reference in a new issue