From owner-freebsd-arch@freebsd.org Fri Mar 10 19:41:44 2017 Return-Path: Delivered-To: freebsd-arch@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 43B12D060DA for ; Fri, 10 Mar 2017 19:41:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm14-vm3.bullet.mail.ne1.yahoo.com (nm14-vm3.bullet.mail.ne1.yahoo.com [98.138.91.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FE7FEF9 for ; Fri, 10 Mar 2017 19:41:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1489174896; bh=yc28oGIzajllFWolqKSAhEQrDf+EWye4oJwbbSRFKOU=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=S6SXDuQI5g4rXbBbPjzRZjLpZ/l5/p3cr8oxREUYPTkpPIq5yVe5O/UC70kB24PRBJjaP4KFgPrK3vMz2j3NMqDg/CZ1sq+iTZ6pRwurTHJzvo6UZi0g2pAGXlO97GL3kzoQxVyoGrsuBzdPqky7ysDH8hETW7pNRKwNOrVJdpskO2vRwOxSb7WnLP+pCD+VHKbwSNkO91KgNC1+N0cNkI7aLFi9J8wV4fh9QFDycdg95TzTNDnO/RND6HNrABsSLqYge/W5EVjR2FL4UTr58SVZ4t/LhfCBeC81WCe3GcfY6adbvyB0Z3XQEQJ2z2XWSKqhTNmZ645lbKDmnQktNQ== Received: from [98.138.226.180] by nm14.bullet.mail.ne1.yahoo.com with NNFMP; 10 Mar 2017 19:41:36 -0000 Received: from [98.138.226.128] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 10 Mar 2017 19:41:36 -0000 Received: from [127.0.0.1] by smtp215.mail.ne1.yahoo.com with NNFMP; 10 Mar 2017 19:41:36 -0000 X-Yahoo-Newman-Id: 888073.6135.bm@smtp215.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: SY_ixBsVM1mpgQ9vjwaicTDHpWJGq1nXN50egjnHSaq36F2 S5T_C3SZYtjKfWzXhHhDHSjmdYhPo8PWkB_MRnKwp6UJNS_SOUrsVlI9hXL7 ohvPHtfK6RR5yS2HNIPPrMUjOZVmJHGRW7mhAfo_BpThm2t_dvRjm5RfCfTK m93dhpdPcB.3bLtaPEUAV1G1sL8Sb7gxXv4.LNs1OQ3nHvxzWuh5sw6AZ2_n Z7jv4UyObgs83.f.5XV1RRv6yjkXdMPkl057gsbnLzUIAuEGaAZ3WNHywSJn aNC3V62rhi5IQvDiT0TWxDOAUSKudhkbJl9FttrCg5P4rqDDcQkjcTxNUCR2 SUZkGO6QALui8kX.CNZvo_vt1xHKec4ycGKKmuP6pe3t0OzQtXZo4uNlVgmA ad.cIMFYMb2ZyEugdN8.8atuTzdJBcuN4bp06_9Vw0XWMbVnHiPCBCPvO8tg bwvotf7Wf7GJSnI.r6IPbbZZEzTMCQKXMbI3JlZvN3QX1tpaISwVxUKGeEj_ PXIbOqKFp7XyhBt6wZDRuFiXA2kJt1Syj9J1X.Y7DiYroNVo- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: reallocarray(3) and its uses To: Ngie Cooper References: <44f542e8-920f-c6bc-7eb0-2e4dab86a5eb@FreeBSD.org> Cc: FreeBSD-arch list From: Pedro Giffuni Message-ID: <5a99a39b-6ef2-2751-430d-c39d9bcffc48@FreeBSD.org> Date: Fri, 10 Mar 2017 14:44:39 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Mar 2017 19:41:44 -0000 Hello; On 3/10/2017 2:12 PM, Ngie Cooper wrote: >> On Mar 10, 2017, at 09:00, Pedro Giffuni wrote: >> >> Hello; >> >> I wasn't a fan of bringing reallocarray(3) from OpenBSD, but since we have it, I thought I'd take a look at using it. It is rather easy to use so I went around opengrok'ing "realloc" in userland and crosschecking with OpenBSD and I got to this patch: >> >> https://reviews.freebsd.org/D9915 >> >> Current reviewers are mute: I am unsure if they are just deeply impressed and don't want to speak up or if they are simply too busy (most likely the later). There are still more uses in some utilities but I wanted to see what people think of the general idea. > Hi Pedro! > > I'll take a look at the reviews sometime after I get back tomorrow night. I have abandoned the revision: it was too much for a sensible review and I am looking at doing better adaptation of the surrounding code. I will say many of the changes don't have any real effect as they have no chance of overflowing but it does make the code easier to read. > My general thoughts are: if it's an application of library that needs to be portable, don't use it. If not, use it. > > I think it's kind of the same class of API call as reallocf. reallocf is a good extension, but it's not 100% portable. It is more in line with reallocf(). We should avoid using such non-standard functions and at first I was contrary to their use, however, if they are in libc, it is as if they were standard for us. I am not touching contrib/ with such changes, but I see no reason not to use them in libc or the system libraries. Pedro.