summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-11-09 19:44:38 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-11-09 19:44:38 +0100
commitd2ad8df9472c65931c649d312bf0ae46e1ceedd8 (patch)
tree685f4f4fb03724e3628d8c03b7096cb663c377fd
parentd97eb114d5dd63f3f0d5b96d8f34a1613761793e (diff)
kernel/qio: implement concatblock() with pullupblock()
-rw-r--r--sys/src/9/port/qio.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/src/9/port/qio.c b/sys/src/9/port/qio.c
index bd026e5a9..0632af9ac 100644
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -140,29 +140,19 @@ blockalloclen(Block *bp)
}
/*
- * 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);
}
/*