ref: 59dfcf2e336d91cf201a5de0377524df480c881a
parent: 714262cf9f49685e7bc230fc5adbc010f172ed1c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Nov 9 14:44:38 EST 2016
kernel/qio: implement concatblock() with pullupblock()
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -140,29 +140,19 @@
}
/*
- * copy the string of blocks into
+ * copy the string of blocks into
* a single block and free the string
*/
Block*
concatblock(Block *bp)
{- Block *nb, *next;
int len;
if(bp->next == nil)
return bp;
-
- nb = allocb(blocklen(bp));
- for(; bp != nil; bp = next) {- next = bp->next;
- len = BLEN(bp);
- memmove(nb->wp, bp->rp, len);
- nb->wp += len;
- freeb(bp);
- }
- concatblockcnt += BLEN(nb);
- QDEBUG checkb(nb, "concatblock 1");
- return nb;
+ len = blocklen(bp);
+ concatblockcnt += len;
+ return pullupblock(bp, len);
}
/*
--
⑨