From owner-svn-src-head@freebsd.org Wed Apr 27 02:02:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23CF0B1DB8E; Wed, 27 Apr 2016 02:02:46 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA7261113; Wed, 27 Apr 2016 02:02:45 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3R22jVQ039369; Wed, 27 Apr 2016 02:02:45 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3R22jZ5039368; Wed, 27 Apr 2016 02:02:45 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201604270202.u3R22jZ5039368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 27 Apr 2016 02:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298681 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 02:02:46 -0000 Author: araujo Date: Wed Apr 27 02:02:44 2016 New Revision: 298681 URL: https://svnweb.freebsd.org/changeset/base/298681 Log: Use macro MIN() from sys/param.h. MFC after: 2 weeks. Modified: head/sbin/ifconfig/sfp.c Modified: head/sbin/ifconfig/sfp.c ============================================================================== --- head/sbin/ifconfig/sfp.c Wed Apr 27 01:36:25 2016 (r298680) +++ head/sbin/ifconfig/sfp.c Wed Apr 27 02:02:44 2016 (r298681) @@ -738,7 +738,7 @@ read_i2c(struct i2c_info *ii, uint8_t ad req.len = len; while (len > 0) { - l = (len > sizeof(req.data)) ? sizeof(req.data) : len; + l = MIN(sizeof(req.data), len); req.len = l; if (ioctl(ii->fd, SIOCGI2C, ii->ifr) != 0) { ii->error = errno; @@ -762,7 +762,7 @@ dump_i2c_data(struct i2c_info *ii, uint8 while (len > 0) { memset(buf, 0, sizeof(buf)); - read = (len > sizeof(buf)) ? sizeof(buf) : len; + read = MIN(sizeof(buf), len); read_i2c(ii, addr, off, read, buf); if (ii->error != 0) { fprintf(stderr, "Error reading i2c info\n");