From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLwGI-0001Qa-Lo for qemu-devel@nongnu.org; Thu, 12 Feb 2015 11:05:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLwGC-0000GN-Rh for qemu-devel@nongnu.org; Thu, 12 Feb 2015 11:05:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLwGC-0000G3-KF for qemu-devel@nongnu.org; Thu, 12 Feb 2015 11:05:00 -0500 Date: Thu, 12 Feb 2015 17:04:53 +0100 From: Igor Mammedov Message-ID: <20150212170453.7ab8d5bc@nial.brq.redhat.com> In-Reply-To: <54DCC447.2050306@redhat.com> References: <1423511596-2584-1-git-send-email-ehabkost@redhat.com> <1423511596-2584-3-git-send-email-ehabkost@redhat.com> <20150212152231.16e0f268@nial.brq.redhat.com> <54DCC447.2050306@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/3] numa: Reject configuration if CPU appears on multiple nodes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Hu Tao , "Michael S. Tsirkin" , Eduardo Habkost , qemu-devel@nongnu.org On Thu, 12 Feb 2015 16:18:31 +0100 Paolo Bonzini wrote: > > > On 12/02/2015 15:22, Igor Mammedov wrote: > > how about replacing a bunch if fprintf's with something like this: > > > > cpu = 0; > > while((cpu = find_next_bit(present_cpus, MAX_CPUMASK_BITS, cpu + 1)) !=MAX_CPUMASK_BITS) > > str = g_strdup_printf("%s %d", str, cpu); > > > > error_report("CPU(s) present in multiple NUMA nodes: %s\n", str); > > As written above this leaks memory, and there should be no space before > the final %s. So it's not that simple. :) it hasn't been meant as working drop in code > But using error_report is > nicer indeed, and you can use GString to avoid the leak. good to learn about GString > > Paolo >