git: 9front

Download patch

ref: 1da71bf1449f2c6b2dfddae868223303276f8071
parent: 0613c94c942e6c951d3888380ef6122285386631
author: Michael Forney <mforney@mforney.org>
date: Mon Oct 3 01:51:21 EDT 2022

patch: make slurp() return void

It sysfatals if it fails and has no non-success returns.

--- a/sys/src/cmd/patch.c
+++ b/sys/src/cmd/patch.c
@@ -459,7 +459,7 @@
 	free(changed);
 }
 
-int
+void
 slurp(Fbuf *f, char *path)
 {
 	int n, i, fd, sz, len, nlines, linesz;
@@ -502,7 +502,6 @@
 	f->lines = lines;
 	f->nlines = nlines;
 	f->lastln = -1;
-	return 0;
 }
 
 char*
@@ -569,8 +568,8 @@
 	for(i = 0; i < p->nhunk; i++){
 		h = &p->hunk[i];
 		if(curfile == nil || strcmp(curfile, h->newpath) != 0){
-			if(!dryrun && slurp(&f, h->oldpath) == -1)
-				sysfatal("slurp %s: %r", h->oldpath);
+			if(!dryrun)
+				slurp(&f, h->oldpath);
 			curfile = h->newpath;
 			e = f.buf;
 		}
--