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
f40b466b
Commit
f40b466b
authored
Aug 21, 2013
by
zkasheff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs #36, have the FIFO realloc its buffer on resize, as opposed to malloc and memcpy
parent
a34734cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
ft/fifo.cc
ft/fifo.cc
+3
-11
No files found.
ft/fifo.cc
View file @
f40b466b
...
@@ -168,17 +168,9 @@ int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *d
...
@@ -168,17 +168,9 @@ int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *d
if
(
need_space_total
>
fifo
->
memory_size
)
{
if
(
need_space_total
>
fifo
->
memory_size
)
{
// Out of memory at the end.
// Out of memory at the end.
int
next_2
=
next_power_of_two
(
need_space_total
);
int
next_2
=
next_power_of_two
(
need_space_total
);
if
((
2
*
next_2
>
fifo
->
memory_size
)
// resize the fifo
||
(
8
*
next_2
<
fifo
->
memory_size
))
{
XREALLOC_N
(
next_2
,
fifo
->
memory
);
// resize the fifo
fifo
->
memory_size
=
next_2
;
char
*
XMALLOC_N
(
next_2
,
newmem
);
char
*
oldmem
=
fifo
->
memory
;
if
(
newmem
==
0
)
return
ENOMEM
;
memcpy
(
newmem
,
oldmem
,
fifo
->
memory_used
);
fifo
->
memory_size
=
next_2
;
fifo
->
memory
=
newmem
;
toku_free
(
oldmem
);
}
}
}
struct
fifo_entry
*
entry
=
(
struct
fifo_entry
*
)(
fifo
->
memory
+
fifo
->
memory_used
);
struct
fifo_entry
*
entry
=
(
struct
fifo_entry
*
)(
fifo
->
memory
+
fifo
->
memory_used
);
fifo_entry_set_msg_type
(
entry
,
type
);
fifo_entry_set_msg_type
(
entry
,
type
);
...
...
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