summaryrefslogtreecommitdiff
path: root/mysys/charset.c
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-09-06 12:50:02 +0400
committerAlexander Barkov <bar@mariadb.org>2016-09-06 12:50:02 +0400
commitee19806b8e6bb00fa1cd547fe3e75193859d300d (patch)
tree27568e9cc17e2717785af028c65deb912731bfb9 /mysys/charset.c
parente4f6fd5e1252f8c68f449fe820bae88c18bca8f5 (diff)
downloadmariadb-git-ee19806b8e6bb00fa1cd547fe3e75193859d300d.tar.gz
MDEV-9711 NO PAD collations
Based on the patch from Daniil Medvedev (a Google Summer of Code task)
Diffstat (limited to 'mysys/charset.c')
-rw-r--r--mysys/charset.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/mysys/charset.c b/mysys/charset.c
index 2efe415af54..2d9df9f47e4 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -123,13 +123,21 @@ static my_bool init_state_maps(struct charset_info_st *cs)
}
+static MY_COLLATION_HANDLER *get_simple_collation_handler_by_flags(uint flags)
+{
+ return flags & MY_CS_BINSORT ?
+ (flags & MY_CS_NOPAD ?
+ &my_collation_8bit_nopad_bin_handler :
+ &my_collation_8bit_bin_handler) :
+ (flags & MY_CS_NOPAD ?
+ &my_collation_8bit_simple_nopad_ci_handler :
+ &my_collation_8bit_simple_ci_handler);
+}
+
+
static void simple_cs_init_functions(struct charset_info_st *cs)
{
- if (cs->state & MY_CS_BINSORT)
- cs->coll= &my_collation_8bit_bin_handler;
- else
- cs->coll= &my_collation_8bit_simple_ci_handler;
-
+ cs->coll= get_simple_collation_handler_by_flags(cs->state);
cs->cset= &my_charset_8bit_handler;
}