[libvirt] [PATCH 20/32] Convert 'int i' to 'size_t i' in src/nwfilter/ files

Daniel P. Berrange berrange at redhat.com
Wed Jul 10 15:45:22 UTC 2013


On Wed, Jul 10, 2013 at 03:13:28PM +0800, Guannan Ren wrote:
> On 07/08/2013 10:21 PM, Daniel P. Berrange wrote:
> >From: "Daniel P. Berrange" <berrange at redhat.com>
> >
> >Convert the type of loop iterators named 'i', 'j', k',
> >'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
> >'unsigned int', also santizing 'ii', 'jj', 'kk' to use
> >the normal 'i', 'j', 'k' naming
> >
> >Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> >---
> >  src/nwfilter/nwfilter_driver.c            |  5 +++--
> >  src/nwfilter/nwfilter_ebiptables_driver.c |  4 ++--
> >  src/nwfilter/nwfilter_gentech_driver.c    | 21 +++++++++++----------
> >  3 files changed, 16 insertions(+), 14 deletions(-)
> >
> >diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
> >index 0fbc940..57f1f54 100644
> >--- a/src/nwfilter/nwfilter_driver.c
> >+++ b/src/nwfilter/nwfilter_driver.c
> >@@ -441,7 +441,8 @@ nwfilterClose(virConnectPtr conn) {
> >  static int
> >  nwfilterConnectNumOfNWFilters(virConnectPtr conn) {
> >      virNWFilterDriverStatePtr driver = conn->nwfilterPrivateData;
> >-    int i, n;
> >+    size_t i;
> >+    int n;
> >      if (virConnectNumOfNWFiltersEnsureACL(conn) < 0)
> >          return -1;
> >@@ -503,7 +504,7 @@ nwfilterConnectListAllNWFilters(virConnectPtr conn,
> >      int nfilters = 0;
> >      virNWFilterPtr filter = NULL;
> >      virNWFilterObjPtr obj = NULL;
> >-    int i;
> >+    size_t i;
> >      int ret = -1;
> >      virCheckFlags(0, -1);
> 
> missed i in nwfilterConnectListNWFilters()
> 
> >diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
> >index 9a54de4..ee676b7 100644
> >--- a/src/nwfilter/nwfilter_ebiptables_driver.c
> >+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
> >@@ -3705,7 +3705,7 @@ ebiptablesApplyNewRules(const char *ifname,
> >                          int nruleInstances,
> >                          void **_inst)
> >  {
> >-    int i, j;
> >+    size_t i, j;
> >      int cli_status;
> >      ebiptablesRuleInstPtr *inst = (ebiptablesRuleInstPtr *)_inst;
> >      virBuffer buf = VIR_BUFFER_INITIALIZER;
> >@@ -4078,7 +4078,7 @@ ebiptablesRemoveRules(const char *ifname ATTRIBUTE_UNUSED,
> >  {
> >      int rc = 0;
> >      int cli_status;
> >-    int i;
> >+    size_t i;
> >      virBuffer buf = VIR_BUFFER_INITIALIZER;
> >      ebiptablesRuleInstPtr *inst = (ebiptablesRuleInstPtr *)_inst;
> 
> missed i in _ebtablesRemoveSubChains()
>                  ebtablesRenameTmpSubAndRootChains()
>                  ebtablesCreateTmpRootAndSubChains()

Squashing in

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index d21d6ef..0965f63 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -1335,7 +1335,8 @@ virNWFilterDHCPSnoopThread(void *req0)
     virNWFilterSnoopEthHdrPtr packet;
     int ifindex = 0;
     int errcount = 0;
-    int tmp = -1, i, rv, n, pollTo;
+    int tmp = -1, rv, n, pollTo;
+    size_t i;
     char *threadkey = NULL;
     virThreadPoolPtr worker = NULL;
     time_t last_displayed = 0, last_displayed_queue = 0;
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 62b317b..9bb4b4e 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -460,7 +460,8 @@ nwfilterConnectListNWFilters(virConnectPtr conn,
                              char **const names,
                              int nnames) {
     virNWFilterDriverStatePtr driver = conn->nwfilterPrivateData;
-    int got = 0, i;
+    int got = 0;
+    size_t i;
 
     if (virConnectListNWFiltersEnsureACL(conn) < 0)
         return -1;
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 9b032ce..0bbb7ea 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3067,7 +3067,7 @@ _ebtablesRemoveSubChains(virBufferPtr buf,
                          const char *chains)
 {
     char rootchain[MAX_CHAINNAME_LENGTH];
-    unsigned i;
+    size_t i;
 
     NWFILTER_SET_EBTABLES_SHELLVAR(buf);
 
@@ -3159,7 +3159,7 @@ ebtablesRenameTmpSubAndRootChains(virBufferPtr buf,
                                   const char *ifname)
 {
     char rootchain[MAX_CHAINNAME_LENGTH];
-    unsigned i;
+    size_t i;
     char chains[3] = {
         CHAINPREFIX_HOST_IN_TEMP,
         CHAINPREFIX_HOST_OUT_TEMP,
@@ -3664,7 +3664,8 @@ ebtablesCreateTmpRootAndSubChains(virBufferPtr buf,
                                   ebiptablesRuleInstPtr *inst,
                                   int *nRuleInstances)
 {
-    int rc = 0, i;
+    int rc = 0;
+    size_t i;
     virHashKeyValuePairPtr filter_names;
     const virNWFilterChainPriority *priority;
 


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list