[comp.os.minix] No more goto. Feel better now?

msm@attctc.Dallas.TX.US (Michael Mattone) (10/03/89)

I expected to hear complaints about using a goto.  My idea was to make
as few changes to the existing code, structure, indentation, etc.  as
possible.  I hoped that the concept, not the implementation would be
examined.  If the concept was on the right track, the offical version
would be implemented whatever way AST decided was best (I wonder if
that would mean w/o the g-word?).

Thanks for the abuse.  Now, quit picking on me.

---------------------------------cut here---------------------------------
echo x - read.c.cdif
sed '/^X/s///' > read.c.cdif << '/'
X*** read.c.o	Wed Sep 27 18:37:59 1989
X--- read.c	Sat Sep 30 05:14:31 1989
X***************
X*** 56,62 ****
X    register int oflags;
X    file_pos position;
X    int r, chunk, mode_word, usr, seg, block_spec, char_spec, regular;
X!   int  xbytes;
X    struct filp *wf;
X    extern struct super_block *get_super();
X    extern struct filp *find_filp(), *get_filp();
X--- 56,62 ----
X    register int oflags;
X    file_pos position;
X    int r, chunk, mode_word, usr, seg, block_spec, char_spec, regular;
X!   int  xbytes, bigpipe = FALSE;
X    struct filp *wf;
X    extern struct super_block *get_super();
X    extern struct filp *find_filp(), *get_filp();
X***************
X*** 95,100 ****
X--- 95,101 ----
X    if (block_spec && f_size == 0) f_size = MAX_P_LONG;
X    rdwt_err = OK;		/* set to EIO if disk error occurs */
X  
X+  do {
X    /* Check for character special files. */
X    if (char_spec) {
X  	if ((r = dev_io(rw_flag, oflags, (dev_nr) rip->i_zone[0],
X***************
X*** 119,125 ****
X  		if (position > f_size) clear_zone(rip, f_size, 0);
X  	}
X  
X- bigpipe:
X  	xbytes = nbytes;
X  	/* Pipes are a little different.  Check. */
X  	if (rip->i_pipe && (r = pipe_check(rip, rw_flag, oflags, nbytes,
X--- 120,125 ----
X***************
X*** 160,170 ****
X  	rip->i_dirt = DIRTY;
X  	if (r == OK && rip->i_pipe) {
X  		fp->fp_tot_io += cum_io;
X! 		if (nbytes > xbytes) {
X! 			f->filp_pos = position;	/* just in case */
X! 			goto bigpipe;		/* more in a pipe to do */
X! 		}
X! 		cum_io = fp->fp_tot_io;		/* for accurate count */
X  	}
X    } else {
X  	if (rip->i_pipe && position >= rip->i_size) {
X--- 160,171 ----
X  	rip->i_dirt = DIRTY;
X  	if (r == OK && rip->i_pipe) {
X  		fp->fp_tot_io += cum_io;
X! 		if (nbytes != 0)
X! 			bigpipe = TRUE;
X! 		else {
X! 			cum_io = fp->fp_tot_io;	/* for accurate count */
X! 			bigpipe = FALSE;
X! 		}
X  	}
X    } else {
X  	if (rip->i_pipe && position >= rip->i_size) {
X***************
X*** 175,180 ****
X--- 176,182 ----
X  	}
X    }
X    f->filp_pos = position;
X+  } while (bigpipe == TRUE);
X  
X    /* Check to see if read-ahead is called for, and if so, set it up. */
X    if (rw_flag == READING && rip->i_seek == NO_SEEK && position % BLOCK_SIZE== 0
/
exit 0