Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm3Ct-00060U-V9 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:18:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm3Cp-0005zq-RO for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:18:19 -0400 Received: from [199.232.76.173] (port=45969 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm3Cp-0005zn-IM for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:18:15 -0400 Received: from mx20.gnu.org ([199.232.41.8]:9959) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mm3Cp-000324-5T for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:18:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mm3Co-00072s-Ge for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:18:14 -0400 From: Juan Quintela In-Reply-To: <4AAA1A3E.6080408@siemens.com> (Jan Kiszka's message of "Fri, 11 Sep 2009 11:37:02 +0200") References: <4AAA1293.1080408@siemens.com> <4AAA1A3E.6080408@siemens.com> Date: Fri, 11 Sep 2009 12:15:34 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: "qemu-devel@nongnu.org" Jan Kiszka wrote: > Juan Quintela wrote: >> Jan Kiszka wrote: >>> Juan Quintela wrote: >>>> Signed-off-by: Juan Quintela >>> [...] >>> >>>> diff --git a/vl.c b/vl.c >>>> index 448ec6c..33abef2 100644 >>>> --- a/vl.c >>>> +++ b/vl.c >>>> @@ -186,7 +186,7 @@ enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; >>>> static DisplayState *display_state; >>>> DisplayType display_type = DT_DEFAULT; >>>> const char* keyboard_layout = NULL; >>>> -int64_t ticks_per_sec; >>>> +static int64_t ticks_per_sec; >>>> ram_addr_t ram_size; >>>> int nb_nics; >>>> NICInfo nd_table[MAX_NICS]; >>>> @@ -1032,6 +1032,11 @@ int64_t qemu_get_clock(QEMUClock *clock) >>>> } >>>> } >>>> >>>> +int64_t get_ticks_per_sec(void) >>>> +{ >>>> + return ticks_per_sec; >>>> +} >>>> + >>> This refactoring would be even more useful if that one became >>> >>> static inline int64_t get_ticks_per_sec(void) >>> { >>> return QEMU_CLOCK_BASE; >>> } >>> >>> Right now we don't have a use for the ticks_per_sec /variable/, it's >>> always constant. Your interface does not prevent changing this in the >>> future, though, which is just like it should be. >> >> I liked this one on top. > > Why? Because that is how we use it. Mine is refactoring, yours is changing behavior. With my patch, it is still possible to change ticks_per_sec (not that this is a good idea, but that is how the code is today). With yours, you remove that feature. I fully agree with your change. In my book that are _two_ patches. Later, Juan.