WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Remove barbaric abuse of goto out of one nested block an

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Remove barbaric abuse of goto out of one nested block and into a previous one.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Nov 2005 20:14:13 +0000
Delivery-date: Fri, 18 Nov 2005 20:15:19 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID eb3ecf6abe87d6664f3e64cb19e2171eb65ba1c3
# Parent  b7afc0be59b21a8fb771fbc622678e1364d2d306
Remove barbaric abuse of goto out of one nested block and into a previous one.
Remove one other -- less barbaric but still horrible -- use of goto.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r b7afc0be59b2 -r eb3ecf6abe87 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu Nov 17 19:25:47 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Nov 18 13:28:38 2005
@@ -49,19 +49,16 @@
 
     if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
                                       &dom, &corefile) )
-        goto exit;
+        return NULL;
 
     if ( (corefile == NULL) || (corefile[0] == '\0') )
-        goto exit;
+        return NULL;
 
     if ( xc_domain_dumpcore(xc->xc_handle, dom, corefile) != 0 )
         return PyErr_SetFromErrno(xc_error);
     
     Py_INCREF(zero);
     return zero;
-
- exit:
-    return NULL;
 }
 
 static PyObject *pyxc_handle(PyObject *self)
@@ -95,12 +92,7 @@
     {
         if ( !PyList_Check(pyhandle) || 
              (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
-        {
-        out_exception:
-            errno = EINVAL;
-            PyErr_SetFromErrno(xc_error);
-            return NULL;
-        }
+            goto out_exception;
 
         for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
         {
@@ -115,6 +107,11 @@
         return PyErr_SetFromErrno(xc_error);
 
     return PyInt_FromLong(dom);
+
+out_exception:
+    errno = EINVAL;
+    PyErr_SetFromErrno(xc_error);
+    return NULL;
 }
 
 static PyObject *pyxc_domain_max_vcpus(PyObject *self,
@@ -270,10 +267,7 @@
     if ( !PyList_Check(pyhandle) || 
          (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
     {
-    out_exception:
-        errno = EINVAL;
-        PyErr_SetFromErrno(xc_error);
-        return NULL;
+        goto out_exception;
     }
 
     for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
@@ -289,7 +283,13 @@
     
     Py_INCREF(zero);
     return zero;
-}
+
+out_exception:
+    errno = EINVAL;
+    PyErr_SetFromErrno(xc_error);
+    return NULL;
+}
+
 
 static PyObject *pyxc_domain_getinfo(PyObject *self,
                                      PyObject *args,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Remove barbaric abuse of goto out of one nested block and into a previous one., Xen patchbot -unstable <=