Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
og-rek
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
og-rek
Commits
9de0a04a
Commit
9de0a04a
authored
Feb 16, 2017
by
Kamil Kisiel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse buffer in a few other places to save on allocations
parent
9627bcd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
ogorek.go
ogorek.go
+9
-12
No files found.
ogorek.go
View file @
9de0a04a
...
...
@@ -492,13 +492,12 @@ func (d *Decoder) loadBinString() error {
}
v
:=
binary
.
LittleEndian
.
Uint32
(
b
[
:
])
// TODO: use d.buf to reduce allocations?
s
:=
make
([]
byte
,
v
)
_
,
err
=
io
.
ReadFull
(
d
.
r
,
s
)
d
.
buf
.
Reset
()
_
,
err
=
io
.
CopyN
(
&
d
.
buf
,
d
.
r
,
int64
(
v
))
if
err
!=
nil
{
return
err
}
d
.
push
(
string
(
s
))
d
.
push
(
d
.
buf
.
String
(
))
return
nil
}
...
...
@@ -508,13 +507,12 @@ func (d *Decoder) loadShortBinString() error {
return
err
}
// TODO: use d.buf to reduce allocations?
s
:=
make
([]
byte
,
b
)
_
,
err
=
io
.
ReadFull
(
d
.
r
,
s
)
d
.
buf
.
Reset
()
_
,
err
=
io
.
CopyN
(
&
d
.
buf
,
d
.
r
,
int64
(
b
))
if
err
!=
nil
{
return
err
}
d
.
push
(
string
(
s
))
d
.
push
(
d
.
buf
.
String
(
))
return
nil
}
...
...
@@ -825,13 +823,12 @@ func (d *Decoder) loadShortBinUnicode() error {
return
err
}
// TODO: use d.buf to save allocations?
s
:=
make
([]
byte
,
b
)
_
,
err
=
io
.
ReadFull
(
d
.
r
,
s
)
d
.
buf
.
Reset
()
_
,
err
=
io
.
CopyN
(
&
d
.
buf
,
d
.
r
,
int64
(
b
))
if
err
!=
nil
{
return
err
}
d
.
push
(
string
(
s
))
d
.
push
(
d
.
buf
.
String
(
))
return
nil
}
...
...
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