Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Mar 2017 03:26:25 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315096 - head/lib/libc/gen
Message-ID:  <201703120326.v2C3QPVb016563@repo.freebsd.org>

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



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