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
34d4c4f4
Commit
34d4c4f4
authored
Aug 15, 2002
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some speed improvements
parent
e353a35f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
30 deletions
+61
-30
heap/hp_hash.c
heap/hp_hash.c
+15
-8
mysys/hash.c
mysys/hash.c
+3
-1
mysys/mf_casecnv.c
mysys/mf_casecnv.c
+10
-7
mysys/mf_soundex.c
mysys/mf_soundex.c
+2
-1
strings/ctype-mb.c
strings/ctype-mb.c
+18
-6
strings/ctype-simple.c
strings/ctype-simple.c
+13
-7
No files found.
heap/hp_hash.c
View file @
34d4c4f4
...
...
@@ -217,13 +217,16 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
if
(
seg
->
charset
->
hash_sort
)
seg
->
charset
->
hash_sort
(
seg
->
charset
,
pos
,((
uchar
*
)
key
)
-
pos
,
&
nr
,
&
nr2
);
else
{
register
uchar
*
sort_order
=
seg
->
charset
->
sort_order
;
for
(;
pos
<
(
uchar
*
)
key
;
pos
++
)
{
nr
^=
(
ulong
)
((((
uint
)
nr
&
63
)
+
nr2
)
*
((
uint
)
s
eg
->
charset
->
s
ort_order
[(
uint
)
*
pos
]))
+
(
nr
<<
8
);
((
uint
)
sort_order
[(
uint
)
*
pos
]))
+
(
nr
<<
8
);
nr2
+=
3
;
}
}
}
else
{
for
(;
pos
<
(
uchar
*
)
key
;
pos
++
)
...
...
@@ -260,13 +263,17 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
if
(
seg
->
charset
->
hash_sort
)
seg
->
charset
->
hash_sort
(
seg
->
charset
,
pos
,
end
-
pos
,
&
nr
,
&
nr2
);
else
{
register
uchar
*
sort_order
=
seg
->
charset
->
sort_order
;
for
(;
pos
<
end
;
pos
++
)
{
nr
^=
(
ulong
)
((((
uint
)
nr
&
63
)
+
nr2
)
*
((
uint
)
s
eg
->
charset
->
s
ort_order
[(
uint
)
*
pos
]))
+
(
nr
<<
8
);
((
uint
)
sort_order
[(
uint
)
*
pos
]))
+
(
nr
<<
8
);
nr2
+=
3
;
}
}
}
else
{
for
(;
pos
<
end
;
pos
++
)
...
...
mysys/hash.c
View file @
34d4c4f4
...
...
@@ -136,10 +136,12 @@ static uint calc_hashnr(CHARSET_INFO *cs __attribute__((unused)),
static
uint
calc_hashnr_caseup
(
CHARSET_INFO
*
cs
,
const
byte
*
key
,
uint
length
)
{
register
uint
nr
=
1
,
nr2
=
4
;
register
uchar
*
map
=
cs
->
to_upper
;
while
(
length
--
)
{
nr
^=
(((
nr
&
63
)
+
nr2
)
*
((
uint
)
(
uchar
)
m
y_toupper
(
cs
,
*
key
++
)))
+
(
nr
<<
8
);
((
uint
)
(
uchar
)
m
ap
[(
uchar
)
*
key
++
]))
+
(
nr
<<
8
);
nr2
+=
3
;
}
return
((
uint
)
nr
);
...
...
mysys/mf_casecnv.c
View file @
34d4c4f4
...
...
@@ -33,8 +33,10 @@
void
case_sort
(
CHARSET_INFO
*
cs
,
my_string
str
,
uint
length
)
{
register
uchar
*
map
=
cs
->
sort_order
;
for
(
;
length
>
0
;
length
--
,
str
++
)
*
str
=
(
char
)
cs
->
sort_order
[(
uchar
)
*
str
];
*
str
=
(
char
)
map
[(
uchar
)
*
str
];
}
/* case_sort */
...
...
@@ -46,11 +48,11 @@ int my_sortcmp(CHARSET_INFO *cs, const char *s, const char *t, uint len)
else
#endif
{
register
uchar
*
map
=
cs
->
sort_order
;
while
(
len
--
)
{
if
(
cs
->
sort_order
[(
uchar
)
*
s
++
]
!=
cs
->
sort_order
[(
uchar
)
*
t
++
])
return
((
int
)
cs
->
sort_order
[(
uchar
)
s
[
-
1
]]
-
(
int
)
cs
->
sort_order
[(
uchar
)
t
[
-
1
]]);
if
(
map
[(
uchar
)
*
s
++
]
!=
map
[(
uchar
)
*
t
++
])
return
((
int
)
map
[(
uchar
)
s
[
-
1
]]
-
(
int
)
map
[(
uchar
)
t
[
-
1
]]);
}
return
0
;
}
...
...
@@ -67,11 +69,12 @@ int my_sortncmp(CHARSET_INFO *cs,
#endif
{
uint
len
=
min
(
s_len
,
t_len
);
register
uchar
*
map
=
cs
->
sort_order
;
while
(
len
--
)
{
if
(
cs
->
sort_order
[(
uchar
)
*
s
++
]
!=
cs
->
sort_order
[(
uchar
)
*
t
++
])
return
((
int
)
cs
->
sort_order
[(
uchar
)
s
[
-
1
]]
-
(
int
)
cs
->
sort_order
[(
uchar
)
t
[
-
1
]]);
if
(
map
[(
uchar
)
*
s
++
]
!=
map
[(
uchar
)
*
t
++
])
return
((
int
)
map
[(
uchar
)
s
[
-
1
]]
-
(
int
)
map
[(
uchar
)
t
[
-
1
]]);
}
return
(
int
)
(
s_len
-
t_len
);
}
...
...
mysys/mf_soundex.c
View file @
34d4c4f4
...
...
@@ -44,13 +44,14 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr,
{
char
ch
,
last_ch
;
reg3
my_string
end
;
register
uchar
*
map
=
cs
->
to_upper
;
if
(
remove_garbage
)
{
while
(
*
in_pntr
&&
my_isspace
(
cs
,
*
in_pntr
))
/* Skipp pre-space */
in_pntr
++
;
}
*
out_pntr
++
=
m
y_toupper
(
cs
,
*
in_pntr
);
/* Copy first letter */
*
out_pntr
++
=
m
ap
[(
uchar
)
*
in_pntr
];
/* Copy first letter */
last_ch
=
get_scode
(
cs
,
&
in_pntr
,
0
);
/* code of the first letter */
/* for the first 'double-letter */
/* check. */
...
...
strings/ctype-mb.c
View file @
34d4c4f4
...
...
@@ -24,13 +24,15 @@ void my_caseup_str_mb(CHARSET_INFO * cs, char *str)
{
register
uint32
l
;
register
char
*
end
=
str
+
strlen
(
str
);
/* BAR TODO: remove strlen() call */
register
uchar
*
map
=
cs
->
to_upper
;
while
(
*
str
)
{
if
((
l
=
my_ismbchar
(
cs
,
str
,
end
)))
str
+=
l
;
else
{
*
str
=
(
char
)
my_toupper
(
cs
,(
uchar
)
*
str
)
;
*
str
=
(
char
)
map
[(
uchar
)
*
str
]
;
str
++
;
}
}
...
...
@@ -40,13 +42,15 @@ void my_casedn_str_mb(CHARSET_INFO * cs, char *str)
{
register
uint32
l
;
register
char
*
end
=
str
+
strlen
(
str
);
register
uchar
*
map
=
cs
->
to_lower
;
while
(
*
str
)
{
if
((
l
=
my_ismbchar
(
cs
,
str
,
end
)))
str
+=
l
;
else
{
*
str
=
(
char
)
my_tolower
(
cs
,(
uchar
)
*
str
)
;
*
str
=
(
char
)
map
[(
uchar
)
*
str
]
;
str
++
;
}
}
...
...
@@ -56,13 +60,15 @@ void my_caseup_mb(CHARSET_INFO * cs, char *str, uint length)
{
register
uint32
l
;
register
char
*
end
=
str
+
length
;
register
uchar
*
map
=
cs
->
to_upper
;
while
(
str
<
end
)
{
if
((
l
=
my_ismbchar
(
cs
,
str
,
end
)))
str
+=
l
;
else
{
*
str
=
(
char
)
my_toupper
(
cs
,(
uchar
)
*
str
)
;
*
str
=
(
char
)
map
[(
uchar
)
*
str
]
;
str
++
;
}
}
...
...
@@ -72,13 +78,15 @@ void my_casedn_mb(CHARSET_INFO * cs, char *str, uint length)
{
register
uint32
l
;
register
char
*
end
=
str
+
length
;
register
uchar
*
map
=
cs
->
to_lower
;
while
(
str
<
end
)
{
if
((
l
=
my_ismbchar
(
cs
,
str
,
end
)))
str
+=
l
;
else
{
*
str
=
(
char
)
my_tolower
(
cs
,(
uchar
)
*
str
)
;
*
str
=
(
char
)
map
[(
uchar
)
*
str
]
;
str
++
;
}
}
...
...
@@ -88,6 +96,8 @@ int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
{
register
uint32
l
;
register
const
char
*
end
=
s
+
strlen
(
s
);
register
uchar
*
map
=
cs
->
to_upper
;
while
(
s
<
end
)
{
if
((
l
=
my_ismbchar
(
cs
,
s
,
end
)))
...
...
@@ -98,7 +108,7 @@ int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
}
else
if
(
my_ismbhead
(
cs
,
*
t
))
return
1
;
else
if
(
m
y_toupper
(
cs
,(
uchar
)
*
s
++
)
!=
my_toupper
(
cs
,(
uchar
)
*
t
++
)
)
else
if
(
m
ap
[(
uchar
)
*
s
++
]
!=
map
[(
uchar
)
*
t
++
]
)
return
1
;
}
return
*
t
;
...
...
@@ -110,6 +120,8 @@ int my_strncasecmp_mb(CHARSET_INFO * cs,
{
register
uint32
l
;
register
const
char
*
end
=
s
+
len
;
register
uchar
*
map
=
cs
->
to_upper
;
while
(
s
<
end
)
{
if
((
l
=
my_ismbchar
(
cs
,
s
,
end
)))
...
...
@@ -120,7 +132,7 @@ int my_strncasecmp_mb(CHARSET_INFO * cs,
}
else
if
(
my_ismbhead
(
cs
,
*
t
))
return
1
;
else
if
(
m
y_toupper
(
cs
,(
uchar
)
*
s
++
)
!=
my_toupper
(
cs
,(
uchar
)
*
t
++
)
)
else
if
(
m
ap
[(
uchar
)
*
s
++
]
!=
map
[(
uchar
)
*
t
++
]
)
return
1
;
}
return
0
;
...
...
strings/ctype-simple.c
View file @
34d4c4f4
...
...
@@ -46,43 +46,49 @@ int my_strnncoll_simple(CHARSET_INFO * cs,const char *s, uint slen,
void
my_caseup_str_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
)
{
while
((
*
str
=
(
char
)
my_toupper
(
cs
,(
uchar
)
*
str
))
!=
0
)
register
uchar
*
map
=
cs
->
to_upper
;
while
((
*
str
=
(
char
)
map
[(
uchar
)
*
str
])
!=
0
)
str
++
;
}
void
my_casedn_str_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
)
{
while
((
*
str
=
(
char
)
my_tolower
(
cs
,(
uchar
)
*
str
))
!=
0
)
register
uchar
*
map
=
cs
->
to_lower
;
while
((
*
str
=
(
char
)
map
[(
uchar
)
*
str
])
!=
0
)
str
++
;
}
void
my_caseup_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
,
uint
length
)
{
register
uchar
*
map
=
cs
->
to_upper
;
for
(
;
length
>
0
;
length
--
,
str
++
)
*
str
=
(
char
)
m
y_toupper
(
cs
,(
uchar
)
*
str
)
;
*
str
=
(
char
)
m
ap
[(
uchar
)
*
str
]
;
}
void
my_casedn_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
,
uint
length
)
{
register
uchar
*
map
=
cs
->
to_lower
;
for
(
;
length
>
0
;
length
--
,
str
++
)
*
str
=
(
char
)
my_tolower
(
cs
,(
uchar
)
*
str
)
;
*
str
=
(
char
)
map
[(
uchar
)
*
str
]
;
}
int
my_strcasecmp_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
)
{
while
(
my_toupper
(
cs
,(
uchar
)
*
s
)
==
my_toupper
(
cs
,(
uchar
)
*
t
++
))
register
uchar
*
map
=
cs
->
to_upper
;
while
(
map
[(
uchar
)
*
s
]
==
map
[(
uchar
)
*
t
++
])
if
(
!*
s
++
)
return
0
;
return
((
int
)
m
y_toupper
(
cs
,(
uchar
)
s
[
0
])
-
(
int
)
my_toupper
(
cs
,(
uchar
)
t
[
-
1
])
);
return
((
int
)
m
ap
[(
uchar
)
s
[
0
]]
-
(
int
)
map
[(
uchar
)
t
[
-
1
]]
);
}
int
my_strncasecmp_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
,
uint
len
)
{
while
(
len
--
!=
0
&&
my_toupper
(
cs
,(
uchar
)
*
s
++
)
==
my_toupper
(
cs
,(
uchar
)
*
t
++
))
;
register
uchar
*
map
=
cs
->
to_upper
;
while
(
len
--
!=
0
&&
map
[(
uchar
)
*
s
++
]
==
map
[(
uchar
)
*
t
++
])
;
return
(
int
)
len
+
1
;
}
...
...
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