From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RB5xg-0000Uu-Pf for qemu-devel@nongnu.org; Tue, 04 Oct 2011 10:27:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RB5xb-0007RQ-3g for qemu-devel@nongnu.org; Tue, 04 Oct 2011 10:27:12 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:37483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RB5xa-0007RL-SA for qemu-devel@nongnu.org; Tue, 04 Oct 2011 10:27:06 -0400 Received: by iagf6 with SMTP id f6so762580iag.4 for ; Tue, 04 Oct 2011 07:27:06 -0700 (PDT) Message-ID: <4E8B17B6.2030903@codemonkey.ws> Date: Tue, 04 Oct 2011 09:27:02 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <8247c5c1b6078349a1c87e3524b3b7d051df9802.1316782367.git.quintela@redhat.com> In-Reply-To: <8247c5c1b6078349a1c87e3524b3b7d051df9802.1316782367.git.quintela@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/23] migration: use global variable directly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org On 09/23/2011 07:57 AM, Juan Quintela wrote: > We are setting a pointer to a local variable in the previous line, just use > the global variable directly. We remove the ->file test because it is already > done inside qemu_file_set_rate_limit() function. > > Signed-off-by: Juan Quintela > --- > migration.c | 6 ++---- > 1 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/migration.c b/migration.c > index 9bb089a..d5e0eb0 100644 > --- a/migration.c > +++ b/migration.c > @@ -469,7 +469,6 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data) > int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data) > { > int64_t d; > - MigrationState *s; > > d = qdict_get_int(qdict, "value"); > if (d< 0) { > @@ -477,9 +476,8 @@ int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data) > } > max_throttle = d; > > - s = current_migration; > - if (s&& s->file) { > - qemu_file_set_rate_limit(s->file, max_throttle); > + if (current_migration) { > + qemu_file_set_rate_limit(current_migration->file, max_throttle); > } How about we compromise and add a: MigrationState *migrate_get_current(void); I'm strongly opposed to propagating direct usage of a global. If it's at least a function call, that's a bit nicer. Regards, Anthony Liguori > > return 0;