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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
af06683b
Commit
af06683b
authored
Jun 18, 2017
by
Michael Widenius
Committed by
Sergei Golubchik
Aug 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize make_lex_string() to not call alloc_root twice.
parent
8bfda2f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
sql/sql_class.h
sql/sql_class.h
+18
-4
No files found.
sql/sql_class.h
View file @
af06683b
...
...
@@ -3368,17 +3368,31 @@ class THD :public Statement,
LEX_STRING
*
make_lex_string
(
const
char
*
str
,
uint
length
)
{
LEX_STRING
*
lex_str
;
if
(
!
(
lex_str
=
(
LEX_STRING
*
)
alloc_root
(
mem_root
,
sizeof
(
LEX_STRING
))))
char
*
tmp
;
if
(
!
(
lex_str
=
(
LEX_STRING
*
)
alloc_root
(
mem_root
,
sizeof
(
LEX_STRING
)
+
length
+
1
)))
return
0
;
return
make_lex_string
(
lex_str
,
str
,
length
);
tmp
=
(
char
*
)
(
lex_str
+
1
);
lex_str
->
str
=
tmp
;
memcpy
(
tmp
,
str
,
length
);
tmp
[
length
]
=
0
;
lex_str
->
length
=
length
;
return
lex_str
;
}
LEX_CSTRING
*
make_clex_string
(
const
char
*
str
,
uint
length
)
{
LEX_CSTRING
*
lex_str
;
if
(
!
(
lex_str
=
(
LEX_CSTRING
*
)
alloc_root
(
mem_root
,
sizeof
(
LEX_CSTRING
))))
char
*
tmp
;
if
(
!
(
lex_str
=
(
LEX_CSTRING
*
)
alloc_root
(
mem_root
,
sizeof
(
LEX_CSTRING
)
+
length
+
1
)))
return
0
;
return
make_lex_string
(
lex_str
,
str
,
length
);
tmp
=
(
char
*
)
(
lex_str
+
1
);
lex_str
->
str
=
tmp
;
memcpy
(
tmp
,
str
,
length
);
tmp
[
length
]
=
0
;
lex_str
->
length
=
length
;
return
lex_str
;
}
// Allocate LEX_STRING for character set conversion
...
...
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