From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6238 invoked by alias); 22 Feb 2011 15:21:57 -0000 Received: (qmail 6212 invoked by uid 22791); 22 Feb 2011 15:21:56 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Feb 2011 15:21:54 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1MFLMfw025314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Feb 2011 10:21:22 -0500 Received: from [10.36.7.68] (vpn1-7-68.ams2.redhat.com [10.36.7.68]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1MFLJYu002337; Tue, 22 Feb 2011 10:21:19 -0500 Message-ID: <4D63D49D.90101@redhat.com> Date: Tue, 22 Feb 2011 15:21:00 -0000 From: Nick Clifton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: Kai Tietz CC: Pierre Muller , GCC Patches , Binutils , gdb , Jakub Jelinek , Joel Brobecker Subject: Re: [RFC patch]: Adjust the use of 'long' type in dwarf2.h header References: <-8460070221060995487@unknownmsgid> <-6930711422310680743@unknownmsgid> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00267.txt.bz2 Hi Kai, > So this version uses new function dwarf_vma_print function for > printf-messages, which are getting localized. > > Tested for x86_64-w64-mingw32 and x86_64-pc-linux-gnu. Ok for apply? > +static const char * > +dwarf_vma_print (const char *fmtch, bfd_vma value) I think that I prefer your suggestion of dwarf_vmatoa. > +{ > + static int buf_pos = 0; > + static struct dwarf_vma_print_buf { > + char place[64]; > + } buf[16]; Ideally you should have a comment here explaining why you have an array of these string buffers. > + char fmt[32]; > + char *ret; > + > + sprintf (fmt, "%%%s%s", BFD_VMA_FMT, fmtch); > + ret = &buf[buf_pos++].place[0]; Or, more simply: ret = buf[buf_pos++].place; > + buf_pos &= 15; That "15" should be: "ARRAY_SIZE (buf) - 1", and it would be safer to write: buf_pos %= ARRAY_SIZE (buf); and leave it to the compiler to optimize this into an AND operation if it can. > snprintf (ret, 64, fmt, value); And the "64" here should be "sizeof (buf[0].place)". Cheers Nick