Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Apr 2016 06:24:13 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r298394 - head/sbin/restore
Message-ID:  <201604210624.u3L6OD4s056287@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604210624.u3L6OD4s056287>