From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55296 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Odqwp-0007oA-HJ for qemu-devel@nongnu.org; Tue, 27 Jul 2010 16:40:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Odqwo-00089E-Do for qemu-devel@nongnu.org; Tue, 27 Jul 2010 16:40:23 -0400 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:54007 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Odqwo-00088c-7I for qemu-devel@nongnu.org; Tue, 27 Jul 2010 16:40:22 -0400 Date: Wed, 28 Jul 2010 00:39:39 +0400 (MSD) From: malc Subject: Re: [Qemu-devel] [PATCH 07/12] linux-user: Load symbols from the interpreter. In-Reply-To: <4C4F3AB3.5050900@twiddle.net> Message-ID: References: <1280251538-6860-1-git-send-email-rth@twiddle.net> <1280251538-6860-8-git-send-email-rth@twiddle.net> <4C4F3AB3.5050900@twiddle.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org On Tue, 27 Jul 2010, Richard Henderson wrote: > On 07/27/2010 11:45 AM, malc wrote: > >> + syms = realloc(syms, nsyms * sizeof(*syms)); > > > > Realloc can fail here. > > I don't believe it can. This (pre-existing) statement *reduces* > the existing allocation of syms. I'd be surprised if any malloc > implementation fails on a size reduction. Life is full of surprises. realloc$ cat tr.c #include #include int main (void) { void *ptr; for (;;) { ptr = malloc (2); if (!ptr) break; } printf ("result = %p\n", realloc (ptr, 1)); return 0; } realloc$ \time -v ./a.out result = (nil) Command being timed: "./a.out" User time (seconds): 5.62 [..snip..] > That said, I'd be happy enough to eliminate the call entirely. -- mailto:av1474@comtv.ru