Require spaces around equality comparisons

Commit a1cbe4b5 added a check for spaces around assignments and this
patch extends it to checks for spaces around '=='.  One exception is
virAssertCmpInt where comma after '==' is acceptable (since it is a
macro and '==' is its argument).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-03-17 10:38:38 +01:00
parent 123a881d97
commit cc9c62fef9
55 changed files with 91 additions and 88 deletions

View File

@ -145,9 +145,12 @@ foreach my $file (@ARGV) {
last; last;
} }
# Require spaces around assignment '=' and compounds # Require spaces around assignment '=', compounds and '=='
while ($data =~ /[^!<>&|\-+*\/%\^'= ]=[^=]/ || # with the exception of virAssertCmpInt()
$data =~ /[^!<>&|\-+*\/%\^'=]=[^= \\\n]/) { while ($data =~ /[^!<>&|\-+*\/%\^'= ]=\+[^=]/ ||
$data =~ /[^!<>&|\-+*\/%\^'=]=[^= \\\n]/ ||
$data =~ /[\S]==/ ||
($data =~ /==[^\s,]/ && $data !~ /[\s]virAssertCmpInt\(/)) {
print "$file:$.: $line"; print "$file:$.: $line";
$ret = 1; $ret = 1;
last; last;

View File

@ -1,7 +1,7 @@
/* /*
* lock_driver_sanlock.c: A lock driver for Sanlock * lock_driver_sanlock.c: A lock driver for Sanlock
* *
* Copyright (C) 2010-2013 Red Hat, Inc. * Copyright (C) 2010-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,7 +1,7 @@
/* /*
* virnetclient.c: generic network RPC client * virnetclient.c: generic network RPC client
* *
* Copyright (C) 2006-2013 Red Hat, Inc. * Copyright (C) 2006-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -517,8 +517,8 @@ virCgroupDetectPlacement(virCgroupPtr group,
/* /*
* selfpath == "/" + path="" -> "/" * selfpath == "/" + path="" -> "/"
* selfpath=="/libvirt.service" + path="" -> "/libvirt.service" * selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"
* selfpath=="/libvirt.service" + path="foo" -> "/libvirt.service/foo" * selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
*/ */
if (typelen == len && STREQLEN(typestr, tmp, len) && if (typelen == len && STREQLEN(typestr, tmp, len) &&
group->controllers[i].mountPoint != NULL && group->controllers[i].mountPoint != NULL &&

View File

@ -1,6 +1,7 @@
/* /*
* virthreadpool.c: a generic thread pool implementation * virthreadpool.c: a generic thread pool implementation
* *
* Copyright (C) 2014 Red Hat, Inc.
* Copyright (C) 2010 Hu Tao * Copyright (C) 2010 Hu Tao
* Copyright (C) 2010 Daniel P. Berrange * Copyright (C) 2010 Daniel P. Berrange
* *

View File

@ -1,6 +1,6 @@
/* /*
* xenapi_driver.c: Xen API driver. * xenapi_driver.c: Xen API driver.
* Copyright (C) 2011-2013 Red Hat, Inc. * Copyright (C) 2011-2014 Red Hat, Inc.
* Copyright (C) 2009, 2010 Citrix Ltd. * Copyright (C) 2009, 2010 Citrix Ltd.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2013 Red Hat, Inc. * Copyright (C) 2012-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,7 +1,7 @@
/* /*
* sockettest.c: Testing for src/util/network.c APIs * sockettest.c: Testing for src/util/network.c APIs
* *
* Copyright (C) 2010-2011 Red Hat, Inc. * Copyright (C) 2010-2011, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Red Hat, Inc. * Copyright (C) 2012, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2013, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Red Hat, Inc. * Copyright (C) 2012, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2013, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011, 2012 Red Hat, Inc. * Copyright (C) 2011, 2012, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011, 2013 Red Hat, Inc. * Copyright (C) 2011, 2013, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Red Hat, Inc. * Copyright (C) 2011, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011-2013 Red Hat, Inc. * Copyright (C) 2011-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011-2012 Red Hat, Inc. * Copyright (C) 2011-2012, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2013, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2013 Red Hat, Inc. * Copyright (C) 2012-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -425,7 +425,6 @@ mymain(void)
if (virtTestRun("virStringSortCompare", testStringSortCompare, NULL) < 0) if (virtTestRun("virStringSortCompare", testStringSortCompare, NULL) < 0)
ret = -1; ret = -1;
#define TEST_SEARCH(s, r, x, n, m, e) \ #define TEST_SEARCH(s, r, x, n, m, e) \
do { \ do { \
struct stringSearchData data = { \ struct stringSearchData data = { \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2013, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Red Hat, Inc. * Copyright (C) 2011, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Red Hat, Inc. * Copyright (C) 2012, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View File

@ -1,7 +1,7 @@
/* /*
* xmconfigtest.c: Test backend for xm_internal config file handling * xmconfigtest.c: Test backend for xm_internal config file handling
* *
* Copyright (C) 2007, 2010-2011 Red Hat, Inc. * Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public