Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
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
Levin Zimmermann
go-fuse
Commits
6fd2fb13
Commit
6fd2fb13
authored
Apr 20, 2015
by
Frederick Akalin
Committed by
Han-Wen Nienhuys
Apr 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make BufferPool.AllocBuffer() return a buffer of the correct size.
Fixes #39.
parent
60423690
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
fuse/bufferpool.go
fuse/bufferpool.go
+1
-1
fuse/bufferpool_test.go
fuse/bufferpool_test.go
+15
-0
No files found.
fuse/bufferpool.go
View file @
6fd2fb13
...
@@ -78,7 +78,7 @@ func (p *bufferPoolImpl) AllocBuffer(size uint32) []byte {
...
@@ -78,7 +78,7 @@ func (p *bufferPoolImpl) AllocBuffer(size uint32) []byte {
pages
:=
sz
/
PAGESIZE
pages
:=
sz
/
PAGESIZE
b
:=
p
.
getPool
(
pages
)
.
Get
()
.
([]
byte
)
b
:=
p
.
getPool
(
pages
)
.
Get
()
.
([]
byte
)
return
b
return
b
[
:
size
]
}
}
func
(
p
*
bufferPoolImpl
)
FreeBuffer
(
slice
[]
byte
)
{
func
(
p
*
bufferPoolImpl
)
FreeBuffer
(
slice
[]
byte
)
{
...
...
fuse/bufferpool_test.go
0 → 100644
View file @
6fd2fb13
package
fuse
import
(
"testing"
)
func
TestBufferPool
(
t
*
testing
.
T
)
{
bp
:=
NewBufferPool
()
size
:=
1500
buf
:=
bp
.
AllocBuffer
(
uint32
(
size
))
if
len
(
buf
)
!=
size
{
t
.
Errorf
(
"Expected buffer of %d bytes, got %d bytes"
,
size
,
len
(
buf
))
}
bp
.
FreeBuffer
(
buf
)
}
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