svn commit: r298394 - head/sbin/restore

Marcelo Araujo araujo at FreeBSD.org
Thu Apr 21 06:24:15 UTC 2016


Author: araujo
Date: Thu Apr 21 06:24:13 2016
New Revision: 298394
URL: https://svnweb.freebsd.org/changeset/base/298394

Log:
  Use MIN()/MAX() macros from sys/param.h.
  
  MFC after:	2 weeks.

Modified:
  head/sbin/restore/dirs.c
  head/sbin/restore/tape.c

Modified: head/sbin/restore/dirs.c
==============================================================================
--- head/sbin/restore/dirs.c	Thu Apr 21 06:21:33 2016	(r298393)
+++ head/sbin/restore/dirs.c	Thu Apr 21 06:24:13 2016	(r298394)
@@ -690,7 +690,7 @@ genliteraldir(char *name, ino_t ino)
 	rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);
 	dp = dup(dirp->dd_fd);
 	for (i = itp->t_size; i > 0; i -= BUFSIZ) {
-		size = i < BUFSIZ ? i : BUFSIZ;
+		size = MIN(i, BUFSIZ);
 		if (read(dp, buf, (int) size) == -1) {
 			fprintf(stderr,
 			    "write error extracting inode %ju, name %s\n",

Modified: head/sbin/restore/tape.c
==============================================================================
--- head/sbin/restore/tape.c	Thu Apr 21 06:21:33 2016	(r298393)
+++ head/sbin/restore/tape.c	Thu Apr 21 06:24:13 2016	(r298394)
@@ -132,7 +132,7 @@ setinput(char *source, int ispipecommand
 	if (bflag)
 		newtapebuf(ntrec);
 	else
-		newtapebuf(NTREC > HIGHDENSITYTREC ? NTREC : HIGHDENSITYTREC);
+		newtapebuf(MAX(NTREC, HIGHDENSITYTREC));
 	terminal = stdin;
 
 	if (ispipecommand)
@@ -1010,7 +1010,7 @@ loop:
 			 * block of the hole in the file. Postpone the
 			 * seek until next file write.
 			 */
-			seekpos += (long)(size > TP_BSIZE ? TP_BSIZE : size);
+			seekpos += (long)MIN(TP_BSIZE, size);
 		}
 		if ((size -= TP_BSIZE) <= 0) {
 			if (size > -TP_BSIZE && curblk > 0) {


More information about the svn-src-all mailing list