1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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

View File

@ -1,7 +1,7 @@
/*
* 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
* modify it under the terms of the GNU Lesser General Public

View File

@ -1,7 +1,7 @@
/*
* 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
* modify it under the terms of the GNU Lesser General Public

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/*
* 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.
*
* 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
* 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
*
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* modify it under the terms of the GNU Lesser General Public
@ -425,7 +425,6 @@ mymain(void)
if (virtTestRun("virStringSortCompare", testStringSortCompare, NULL) < 0)
ret = -1;
#define TEST_SEARCH(s, r, x, n, m, e) \
do { \
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
* 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
* 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
* 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
*
* 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
* modify it under the terms of the GNU Lesser General Public