[libvirt] [libvirt-python PATCH 08/23] fix indentation

Pavel Hrdina phrdina at redhat.com
Thu Sep 24 14:01:45 UTC 2015


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 libvirt-lxc-override.c  |  30 ++++++------
 libvirt-override.c      | 125 ++++++++++++++++++++++--------------------------
 libvirt-qemu-override.c |  41 ++++++++--------
 typewrappers.c          |   8 ++--
 4 files changed, 96 insertions(+), 108 deletions(-)

diff --git a/libvirt-lxc-override.c b/libvirt-lxc-override.c
index 2a3619e..8f5bb0c 100644
--- a/libvirt-lxc-override.c
+++ b/libvirt-lxc-override.c
@@ -41,10 +41,10 @@ extern void initcygvirtmod_lxc(void);
 
 #if DEBUG_ERROR
 # define DEBUG(fmt, ...)            \
-   printf(fmt, __VA_ARGS__)
+    printf(fmt, __VA_ARGS__)
 #else
 # define DEBUG(fmt, ...)            \
-   do {} while (0)
+    do {} while (0)
 #endif
 
 /************************************************************************
@@ -114,19 +114,19 @@ static PyMethodDef libvirtLxcMethods[] = {
 
 #if PY_MAJOR_VERSION > 2
 static struct PyModuleDef moduledef = {
-        PyModuleDef_HEAD_INIT,
+    PyModuleDef_HEAD_INIT,
 # ifndef __CYGWIN__
-        "libvirtmod_lxc",
+    "libvirtmod_lxc",
 # else
-        "cygvirtmod_lxc",
+    "cygvirtmod_lxc",
 # endif
-        NULL,
-        -1,
-        libvirtLxcMethods,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+    NULL,
+    -1,
+    libvirtLxcMethods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
 };
 
 PyObject *
@@ -135,7 +135,7 @@ PyInit_libvirtmod_lxc
 # else
 PyInit_cygvirtmod_lxc
 # endif
-  (void)
+(void)
 {
     PyObject *module;
 
@@ -153,7 +153,7 @@ initlibvirtmod_lxc
 # else
 initcygvirtmod_lxc
 # endif
-  (void)
+(void)
 {
     if (virInitialize() < 0)
         return;
@@ -165,6 +165,6 @@ initcygvirtmod_lxc
 # else
                   "cygvirtmod_lxc",
 # endif
-		  libvirtLxcMethods);
+                  libvirtLxcMethods);
 }
 #endif /* ! PY_MAJOR_VERSION > 2 */
diff --git a/libvirt-override.c b/libvirt-override.c
index 4c5590a..cf4fedb 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -45,10 +45,10 @@ extern void initcygvirtmod(void);
 
 #if DEBUG_ERROR
 # define DEBUG(fmt, ...)            \
-   printf(fmt, __VA_ARGS__)
+    printf(fmt, __VA_ARGS__)
 #else
 # define DEBUG(fmt, ...)            \
-   do {} while (0)
+    do {} while (0)
 #endif
 
 
@@ -101,7 +101,7 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED,
     PyObject *info;
 
     if (!PyArg_ParseTuple(args, (char *)"Oz:virDomainBlockStats",
-        &pyobj_domain, &path))
+                          &pyobj_domain, &path))
         return NULL;
     domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
 
@@ -319,7 +319,7 @@ libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED,
     PyObject *info;
 
     if (!PyArg_ParseTuple(args, (char *)"Oz:virDomainInterfaceStats",
-        &pyobj_domain, &path))
+                          &pyobj_domain, &path))
         return NULL;
     domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
 
@@ -498,7 +498,7 @@ libvirt_virDomainGetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED,
 
 static PyObject *
 libvirt_virDomainGetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
-                                        PyObject *args)
+                                             PyObject *args)
 {
     virDomainPtr domain;
     PyObject *pyobj_domain;
@@ -1258,10 +1258,10 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
             goto itemError;
 
         continue;
-        itemError:
-            Py_DECREF(info);
-            Py_XDECREF(item);
-            goto cleanup;
+     itemError:
+        Py_DECREF(info);
+        Py_XDECREF(item);
+        goto cleanup;
     }
     for (i = 0; i < dominfo.nrVirtCpu; i++) {
         PyObject *info = PyTuple_New(cpunum);
@@ -1326,8 +1326,8 @@ libvirt_virDomainPinVcpu(PyObject *self ATTRIBUTE_UNUSED,
         if (tuple_size == -1)
             return ret;
     } else {
-       PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required");
-       return ret;
+        PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required");
+        return ret;
     }
 
     cpumaplen = VIR_CPU_MAPLEN(cpunum);
@@ -1391,8 +1391,8 @@ libvirt_virDomainPinVcpuFlags(PyObject *self ATTRIBUTE_UNUSED,
         if (tuple_size == -1)
             return ret;
     } else {
-       PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required");
-       return ret;
+        PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required");
+        return ret;
     }
 
     cpumaplen = VIR_CPU_MAPLEN(cpunum);
@@ -1520,8 +1520,8 @@ libvirt_virDomainPinEmulator(PyObject *self ATTRIBUTE_UNUSED,
     cpumaplen = VIR_CPU_MAPLEN(cpunum);
 
     if (!PyTuple_Check(pycpumap)) {
-       PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required");
-       return NULL;
+        PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required");
+        return NULL;
     }
 
     if ((tuple_size = PyTuple_Size(pycpumap)) == -1)
@@ -1889,9 +1889,8 @@ libvirt_virRegisterErrorHandler(ATTRIBUTE_UNUSED PyObject * self,
     PyObject *pyobj_f;
     PyObject *pyobj_ctx;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OO:xmlRegisterErrorHandler", &pyobj_f,
-         &pyobj_ctx))
+    if (!PyArg_ParseTuple(args, (char *) "OO:xmlRegisterErrorHandler",
+                          &pyobj_f, &pyobj_ctx))
         return NULL;
 
     DEBUG("libvirt_virRegisterErrorHandler(%p, %p) called\n", pyobj_ctx,
@@ -3202,7 +3201,7 @@ libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);
     for (i = 0; i < c_retval; i++) {
         PyList_SetItem(py_retval, i,
-                libvirt_ulonglongWrap(freeMems[i]));
+                       libvirt_ulonglongWrap(freeMems[i]));
     }
     VIR_FREE(freeMems);
     return py_retval;
@@ -5102,9 +5101,8 @@ libvirt_virConnectDomainEventRegister(ATTRIBUTE_UNUSED PyObject *self,
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OO:virConnectDomainEventRegister",
-                        &pyobj_conn, &pyobj_conn_inst)) {
+    if (!PyArg_ParseTuple(args, (char *) "OO:virConnectDomainEventRegister",
+                          &pyobj_conn, &pyobj_conn_inst)) {
         DEBUG("%s failed parsing tuple\n", __FUNCTION__);
         return VIR_PY_INT_FAIL;
     }
@@ -5138,9 +5136,8 @@ libvirt_virConnectDomainEventDeregister(PyObject *self ATTRIBUTE_UNUSED,
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OO:virConnectDomainEventDeregister",
-         &pyobj_conn, &pyobj_conn_inst))
+    if (!PyArg_ParseTuple(args, (char *) "OO:virConnectDomainEventDeregister",
+                          &pyobj_conn, &pyobj_conn_inst))
         return NULL;
 
     DEBUG("libvirt_virConnectDomainEventDeregister(%p) called\n", pyobj_conn);
@@ -5500,10 +5497,8 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED,
     virEventHandleCallback cb;
     void *opaque;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "iiiOO:virEventInvokeHandleCallback",
-         &watch, &fd, &event, &py_f, &py_opaque
-        ))
+    if (!PyArg_ParseTuple(args, (char *) "iiiOO:virEventInvokeHandleCallback",
+                          &watch, &fd, &event, &py_f, &py_opaque))
         return VIR_PY_INT_FAIL;
 
     cb     = (virEventHandleCallback) PyvirEventHandleCallback_Get(py_f);
@@ -5528,10 +5523,8 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED,
     virEventTimeoutCallback cb;
     void *opaque;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "iOO:virEventInvokeTimeoutCallback",
-                        &timer, &py_f, &py_opaque
-        ))
+    if (!PyArg_ParseTuple(args, (char *) "iOO:virEventInvokeTimeoutCallback",
+                          &timer, &py_f, &py_opaque))
         return VIR_PY_INT_FAIL;
 
     cb     = (virEventTimeoutCallback) PyvirEventTimeoutCallback_Get(py_f);
@@ -6702,15 +6695,15 @@ libvirt_virConnectDomainEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED,
     virConnectDomainEventGenericCallback cb = NULL;
     virDomainPtr dom;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OOiO:virConnectDomainEventRegisterAny",
-         &pyobj_conn, &pyobj_dom, &eventID, &pyobj_cbData)) {
+    if (!PyArg_ParseTuple(args,
+                          (char *) "OOiO:virConnectDomainEventRegisterAny",
+                          &pyobj_conn, &pyobj_dom, &eventID, &pyobj_cbData)) {
         DEBUG("%s failed parsing tuple\n", __FUNCTION__);
         return VIR_PY_INT_FAIL;
     }
 
     DEBUG("libvirt_virConnectDomainEventRegister(%p %p %d %p) called\n",
-           pyobj_conn, pyobj_dom, eventID, pyobj_cbData);
+          pyobj_conn, pyobj_dom, eventID, pyobj_cbData);
     conn = PyvirConnect_Get(pyobj_conn);
     if (pyobj_dom == Py_None)
         dom = NULL;
@@ -6824,9 +6817,8 @@ libvirt_virConnectDomainEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "Oi:virConnectDomainEventDeregister",
-         &pyobj_conn, &callbackID))
+    if (!PyArg_ParseTuple(args, (char *) "Oi:virConnectDomainEventDeregister",
+                          &pyobj_conn, &callbackID))
         return NULL;
 
     DEBUG("libvirt_virConnectDomainEventDeregister(%p) called\n", pyobj_conn);
@@ -6920,15 +6912,15 @@ libvirt_virConnectNetworkEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED,
     virConnectNetworkEventGenericCallback cb = NULL;
     virNetworkPtr net;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OOiO:virConnectNetworkEventRegisterAny",
-         &pyobj_conn, &pyobj_net, &eventID, &pyobj_cbData)) {
+    if (!PyArg_ParseTuple(args,
+                          (char *) "OOiO:virConnectNetworkEventRegisterAny",
+                          &pyobj_conn, &pyobj_net, &eventID, &pyobj_cbData)) {
         DEBUG("%s failed parsing tuple\n", __FUNCTION__);
         return VIR_PY_INT_FAIL;
     }
 
     DEBUG("libvirt_virConnectNetworkEventRegister(%p %p %d %p) called\n",
-           pyobj_conn, pyobj_net, eventID, pyobj_cbData);
+          pyobj_conn, pyobj_net, eventID, pyobj_cbData);
     conn = PyvirConnect_Get(pyobj_conn);
     if (pyobj_net == Py_None)
         net = NULL;
@@ -6974,9 +6966,8 @@ libvirt_virConnectNetworkEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "Oi:virConnectNetworkEventDeregister",
-         &pyobj_conn, &callbackID))
+    if (!PyArg_ParseTuple(args, (char *) "Oi:virConnectNetworkEventDeregister",
+                          &pyobj_conn, &callbackID))
         return NULL;
 
     DEBUG("libvirt_virConnectNetworkEventDeregister(%p) called\n", pyobj_conn);
@@ -7041,15 +7032,14 @@ libvirt_virConnectRegisterCloseCallback(PyObject * self ATTRIBUTE_UNUSED,
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OO:virConnectRegisterCloseCallback",
-         &pyobj_conn, &pyobj_cbData)) {
+    if (!PyArg_ParseTuple(args, (char *) "OO:virConnectRegisterCloseCallback",
+                          &pyobj_conn, &pyobj_cbData)) {
         DEBUG("%s failed parsing tuple\n", __FUNCTION__);
         return VIR_PY_INT_FAIL;
     }
 
     DEBUG("libvirt_virConnectRegisterCloseCallback(%p %p) called\n",
-           pyobj_conn, pyobj_cbData);
+          pyobj_conn, pyobj_cbData);
     conn = PyvirConnect_Get(pyobj_conn);
 
     Py_INCREF(pyobj_cbData);
@@ -7078,9 +7068,8 @@ libvirt_virConnectUnregisterCloseCallback(PyObject * self ATTRIBUTE_UNUSED,
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "O:virConnectDomainEventUnregister",
-         &pyobj_conn))
+    if (!PyArg_ParseTuple(args, (char *) "O:virConnectDomainEventUnregister",
+                          &pyobj_conn))
         return NULL;
 
     DEBUG("libvirt_virConnectDomainEventUnregister(%p) called\n",
@@ -8424,7 +8413,7 @@ libvirt_virDomainGetFSInfo(PyObject *self ATTRIBUTE_UNUSED,
     PyObject *py_retval = NULL;
 
     if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainFSInfo",
-        &pyobj_domain, &flags))
+                          &pyobj_domain, &flags))
         return NULL;
     domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
 
@@ -8687,19 +8676,19 @@ static PyMethodDef libvirtMethods[] = {
 
 #if PY_MAJOR_VERSION > 2
 static struct PyModuleDef moduledef = {
-        PyModuleDef_HEAD_INIT,
+    PyModuleDef_HEAD_INIT,
 # ifndef __CYGWIN__
-        "libvirtmod",
+    "libvirtmod",
 # else
-        "cygvirtmod",
+    "cygvirtmod",
 # endif
-        NULL,
-        -1,
-        libvirtMethods,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+    NULL,
+    -1,
+    libvirtMethods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
 };
 
 PyObject *
@@ -8708,7 +8697,7 @@ PyInit_libvirtmod
 # else
 PyInit_cygvirtmod
 # endif
-  (void)
+(void)
 {
     PyObject *module;
 
@@ -8726,7 +8715,7 @@ initlibvirtmod
 # else
 initcygvirtmod
 # endif
-  (void)
+(void)
 {
     if (virInitialize() < 0)
         return;
@@ -8738,6 +8727,6 @@ initcygvirtmod
 # else
                   "cygvirtmod",
 # endif
-		  libvirtMethods);
+                  libvirtMethods);
 }
 #endif /* ! PY_MAJOR_VERSION > 2 */
diff --git a/libvirt-qemu-override.c b/libvirt-qemu-override.c
index ad1693b..46d513d 100644
--- a/libvirt-qemu-override.c
+++ b/libvirt-qemu-override.c
@@ -41,10 +41,10 @@ extern void initcygvirtmod_qemu(void);
 
 #if DEBUG_ERROR
 # define DEBUG(fmt, ...)            \
-   printf(fmt, __VA_ARGS__)
+    printf(fmt, __VA_ARGS__)
 #else
 # define DEBUG(fmt, ...)            \
-   do {} while (0)
+    do {} while (0)
 #endif
 
 /*******************************************
@@ -270,9 +270,8 @@ libvirt_qemu_virConnectDomainQemuMonitorEventRegister(PyObject *self ATTRIBUTE_U
     virDomainPtr dom;
     unsigned int flags;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "OOzOI",
-         &pyobj_conn, &pyobj_dom, &event, &pyobj_cbData, &flags)) {
+    if (!PyArg_ParseTuple(args, (char *) "OOzOI", &pyobj_conn, &pyobj_dom,
+                          &event, &pyobj_cbData, &flags)) {
         DEBUG("%s failed parsing tuple\n", __FUNCTION__);
         return VIR_PY_INT_FAIL;
     }
@@ -315,9 +314,9 @@ libvirt_qemu_virConnectDomainQemuMonitorEventDeregister(PyObject *self ATTRIBUTE
     virConnectPtr conn;
     int ret = 0;
 
-    if (!PyArg_ParseTuple
-        (args, (char *) "Oi:virConnectDomainQemuMonitorEventDeregister",
-         &pyobj_conn, &callbackID))
+    if (!PyArg_ParseTuple(args,
+                          (char *) "Oi:virConnectDomainQemuMonitorEventDeregister",
+                          &pyobj_conn, &callbackID))
         return NULL;
 
     DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventDeregister(%p) called\n",
@@ -355,19 +354,19 @@ static PyMethodDef libvirtQemuMethods[] = {
 
 #if PY_MAJOR_VERSION > 2
 static struct PyModuleDef moduledef = {
-        PyModuleDef_HEAD_INIT,
+    PyModuleDef_HEAD_INIT,
 # ifndef __CYGWIN__
-        "libvirtmod_qemu",
+    "libvirtmod_qemu",
 # else
-        "cygvirtmod_qemu",
+    "cygvirtmod_qemu",
 # endif
-        NULL,
-        -1,
-        libvirtQemuMethods,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+    NULL,
+    -1,
+    libvirtQemuMethods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
 };
 
 PyObject *
@@ -376,7 +375,7 @@ PyInit_libvirtmod_qemu
 # else
 PyInit_cygvirtmod_qemu
 # endif
-  (void)
+(void)
 {
     PyObject *module;
 
@@ -394,7 +393,7 @@ initlibvirtmod_qemu
 # else
 initcygvirtmod_qemu
 # endif
-  (void)
+(void)
 {
     if (virInitialize() < 0)
         return;
@@ -406,6 +405,6 @@ initcygvirtmod_qemu
 # else
                   "cygvirtmod_qemu",
 # endif
-		  libvirtQemuMethods);
+                  libvirtQemuMethods);
 }
 #endif /* ! PY_MAJOR_VERSION > 2 */
diff --git a/typewrappers.c b/typewrappers.c
index a164a11..6507e0f 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -145,10 +145,10 @@ libvirt_constcharPtrWrap(const char *str)
 PyObject *
 libvirt_boolWrap(int val)
 {
-  if (val)
-      Py_RETURN_TRUE;
-  else
-      Py_RETURN_FALSE;
+    if (val)
+        Py_RETURN_TRUE;
+    else
+        Py_RETURN_FALSE;
 }
 
 int
-- 
2.5.3




More information about the libvir-list mailing list