Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
53a7bd59
Commit
53a7bd59
authored
Jun 11, 2004
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
charset.c:
Reuse some code between simple and UCA collations.
parent
f8b15e8b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
44 deletions
+15
-44
mysys/charset.c
mysys/charset.c
+15
-44
No files found.
mysys/charset.c
View file @
53a7bd59
...
@@ -111,13 +111,11 @@ static void simple_cs_init_functions(CHARSET_INFO *cs)
...
@@ -111,13 +111,11 @@ static void simple_cs_init_functions(CHARSET_INFO *cs)
cs
->
coll
=
&
my_collation_8bit_simple_ci_handler
;
cs
->
coll
=
&
my_collation_8bit_simple_ci_handler
;
cs
->
cset
=
&
my_charset_8bit_handler
;
cs
->
cset
=
&
my_charset_8bit_handler
;
cs
->
mbminlen
=
1
;
cs
->
mbmaxlen
=
1
;
}
}
static
int
simple_
cs_copy_data
(
CHARSET_INFO
*
to
,
CHARSET_INFO
*
from
)
static
int
cs_copy_data
(
CHARSET_INFO
*
to
,
CHARSET_INFO
*
from
)
{
{
to
->
number
=
from
->
number
?
from
->
number
:
to
->
number
;
to
->
number
=
from
->
number
?
from
->
number
:
to
->
number
;
...
@@ -168,8 +166,9 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
...
@@ -168,8 +166,9 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
sz
,
MYF
(
MY_WME
))))
sz
,
MYF
(
MY_WME
))))
goto
err
;
goto
err
;
}
}
to
->
mbminlen
=
1
;
if
(
from
->
tailoring
)
to
->
mbmaxlen
=
1
;
if
(
!
(
to
->
tailoring
=
my_once_strdup
(
from
->
tailoring
,
MYF
(
MY_WME
))))
goto
err
;
return
0
;
return
0
;
...
@@ -297,40 +296,6 @@ static my_tailoring tailoring[]=
...
@@ -297,40 +296,6 @@ static my_tailoring tailoring[]=
}
}
};
};
static
int
ucs2_copy_data
(
CHARSET_INFO
*
to
,
CHARSET_INFO
*
from
)
{
to
->
number
=
from
->
number
?
from
->
number
:
to
->
number
;
if
(
from
->
csname
)
if
(
!
(
to
->
csname
=
my_once_strdup
(
from
->
csname
,
MYF
(
MY_WME
))))
goto
err
;
if
(
from
->
name
)
if
(
!
(
to
->
name
=
my_once_strdup
(
from
->
name
,
MYF
(
MY_WME
))))
goto
err
;
if
(
from
->
comment
)
if
(
!
(
to
->
comment
=
my_once_strdup
(
from
->
comment
,
MYF
(
MY_WME
))))
goto
err
;
if
(
from
->
tailoring
)
if
(
!
(
to
->
tailoring
=
my_once_strdup
(
from
->
tailoring
,
MYF
(
MY_WME
))))
goto
err
;
to
->
strxfrm_multiply
=
my_charset_ucs2_general_uca
.
strxfrm_multiply
;
to
->
min_sort_char
=
my_charset_ucs2_general_uca
.
min_sort_char
;
to
->
max_sort_char
=
my_charset_ucs2_general_uca
.
max_sort_char
;
to
->
mbminlen
=
2
;
to
->
mbmaxlen
=
2
;
return
0
;
err:
return
1
;
}
#endif
#endif
...
@@ -365,22 +330,28 @@ static int add_collation(CHARSET_INFO *cs)
...
@@ -365,22 +330,28 @@ static int add_collation(CHARSET_INFO *cs)
if
(
!
(
all_charsets
[
cs
->
number
]
->
state
&
MY_CS_COMPILED
))
if
(
!
(
all_charsets
[
cs
->
number
]
->
state
&
MY_CS_COMPILED
))
{
{
CHARSET_INFO
*
new
=
all_charsets
[
cs
->
number
];
if
(
cs_copy_data
(
all_charsets
[
cs
->
number
],
cs
))
return
MY_XML_ERROR
;
if
(
!
strcmp
(
cs
->
csname
,
"ucs2"
)
)
if
(
!
strcmp
(
cs
->
csname
,
"ucs2"
)
)
{
{
#ifdef HAVE_CHARSET_ucs2
#ifdef HAVE_CHARSET_ucs2
CHARSET_INFO
*
new
=
all_charsets
[
cs
->
number
];
new
->
cset
=
my_charset_ucs2_general_uca
.
cset
;
new
->
cset
=
my_charset_ucs2_general_uca
.
cset
;
new
->
coll
=
my_charset_ucs2_general_uca
.
coll
;
new
->
coll
=
my_charset_ucs2_general_uca
.
coll
;
if
(
ucs2_copy_data
(
new
,
cs
))
new
->
strxfrm_multiply
=
my_charset_ucs2_general_uca
.
strxfrm_multiply
;
return
MY_XML_ERROR
;
new
->
min_sort_char
=
my_charset_ucs2_general_uca
.
min_sort_char
;
new
->
max_sort_char
=
my_charset_ucs2_general_uca
.
max_sort_char
;
new
->
mbminlen
=
2
;
new
->
mbmaxlen
=
2
;
new
->
state
|=
MY_CS_AVAILABLE
|
MY_CS_LOADED
;
new
->
state
|=
MY_CS_AVAILABLE
|
MY_CS_LOADED
;
#endif
#endif
}
}
else
else
{
{
simple_cs_init_functions
(
all_charsets
[
cs
->
number
]);
simple_cs_init_functions
(
all_charsets
[
cs
->
number
]);
if
(
simple_cs_copy_data
(
all_charsets
[
cs
->
number
],
cs
))
new
->
mbminlen
=
1
;
return
MY_XML_ERROR
;
new
->
mbmaxlen
=
1
;
if
(
simple_cs_is_full
(
all_charsets
[
cs
->
number
]))
if
(
simple_cs_is_full
(
all_charsets
[
cs
->
number
]))
{
{
all_charsets
[
cs
->
number
]
->
state
|=
MY_CS_LOADED
;
all_charsets
[
cs
->
number
]
->
state
|=
MY_CS_LOADED
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment