From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/4] KVM-USER: Make the kvm_allowed flag always defined so we dont need #ifdefs Date: Mon, 14 May 2007 15:09:07 +0300 Message-ID: <46485163.9090204@qumranet.com> References: <20070511203316.22062.4417.stgit@novell1.haskins.net> <20070511204206.22062.7570.stgit@novell1.haskins.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Gregory Haskins Return-path: In-Reply-To: <20070511204206.22062.7570.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Gregory Haskins wrote: > Non-performance critical code is made more awkward by having to always define > both "#ifdef KVM" and "if (kvm_allowed)". Define "kvm_allowed = 0" by > default. Anthony Ligouri is credited with the idea. > > Signed-off-by: Gregory Haskins > --- > > qemu/qemu-kvm.c | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c > index 212570a..d4419a3 100644 > --- a/qemu/qemu-kvm.c > +++ b/qemu/qemu-kvm.c > @@ -3,6 +3,14 @@ > #include "config-host.h" > > #ifdef USE_KVM > + #define KVM_ALLOWED_DEFAULT 1 > +#else > + #define KVM_ALLOWED_DEFAULT 0 > +#endif You could do a #ifndef USE_KVM #define kvm_allowed 0 #else extern int kvm_allowed #endif However, will the code actually compile ifndef USE_KVM? Suppose the headers aren't installed? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/