shithub: clone

Download patch

ref: c52095c4da2055ab62a481e8be4c15919d081ef3
parent: 60568e2476de3fc5117c0d00bc6ad682ecbbc135
author: kvik <kvik@a-b.xyz>
date: Tue Mar 12 17:31:22 EDT 2019

simplify nblk calculation

--- a/clone.c
+++ b/clone.c
@@ -369,13 +369,8 @@
 
 	if(f->length == 0)
 		return 0;
-	nblk = f->length / blksz;
 	odd = f->length % blksz;
-	if(nblk == 0)
-		nblk = 1;
-	else if(odd > 0)
-		nblk++;
-
+	nblk = f->length / blksz + (odd > 0);
 	b = p = emalloc(sizeof(Blk) * nblk);
 	for(i = 0; i < nblk; i++, p++){
 		p->f = f;