From owner-svn-src-all@freebsd.org Sun Mar 12 03:26:26 2017 Return-Path: Delivered-To: svn-src-all@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 726B6D07D1D; Sun, 12 Mar 2017 03:26:26 +0000 (UTC) (envelope-from pfg@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 421CE11CF; Sun, 12 Mar 2017 03:26:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2C3QP3e016564; Sun, 12 Mar 2017 03:26:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2C3QPVb016563; Sun, 12 Mar 2017 03:26:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201703120326.v2C3QPVb016563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 12 Mar 2017 03:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315096 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Mar 2017 03:26:26 -0000 Author: pfg Date: Sun Mar 12 03:26:25 2017 New Revision: 315096 URL: https://svnweb.freebsd.org/changeset/base/315096 Log: libc: small cleanups. Unsign setlen: it is local and will never be negative. Having one more bit for growth is beneficial and it avoids a cast when it's going to be used for allocation. Reviewed by: ngie MFC after: 3 days Modified: head/lib/libc/gen/setmode.c Modified: head/lib/libc/gen/setmode.c ============================================================================== --- head/lib/libc/gen/setmode.c Sun Mar 12 03:22:18 2017 (r315095) +++ head/lib/libc/gen/setmode.c Sun Mar 12 03:26:25 2017 (r315096) @@ -175,7 +175,7 @@ setmode(const char *p) mode_t mask, perm, permXbits, who; long perml; int equalopdone; - int setlen; + u_int setlen; if (!*p) { errno = EINVAL; @@ -190,7 +190,7 @@ setmode(const char *p) setlen = SET_LEN + 2; - if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL) + if ((set = malloc(setlen * sizeof(BITCMD))) == NULL) return (NULL); saveset = set; endset = set + (setlen - 2);