qio: handle common case in trimblock()
This commit is contained in:
parent
5b972a9aea
commit
a2c0e55e68
1 changed files with 4 additions and 1 deletions
|
@ -243,7 +243,10 @@ trimblock(Block *bp, int offset, int len)
|
|||
Block *nb, *startb;
|
||||
|
||||
QDEBUG checkb(bp, "trimblock 1");
|
||||
if(blocklen(bp) < offset+len) {
|
||||
l = blocklen(bp);
|
||||
if(offset == 0 && len == l)
|
||||
return bp;
|
||||
if(l < offset+len) {
|
||||
freeblist(bp);
|
||||
return nil;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue