ia64/xen-unstable

changeset 7902:eb3ecf6abe87

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@xensource.com>
author emellor@leeni.uk.xensource.com
date Fri Nov 18 14:28:38 2005 +0100 (2005-11-18)
parents b7afc0be59b2
children 0dd531d4af46
files tools/python/xen/lowlevel/xc/xc.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Thu Nov 17 20:25:47 2005 +0100
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Nov 18 14:28:38 2005 +0100
     1.3 @@ -49,19 +49,16 @@ static PyObject *pyxc_domain_dumpcore(Py
     1.4  
     1.5      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
     1.6                                        &dom, &corefile) )
     1.7 -        goto exit;
     1.8 +        return NULL;
     1.9  
    1.10      if ( (corefile == NULL) || (corefile[0] == '\0') )
    1.11 -        goto exit;
    1.12 +        return NULL;
    1.13  
    1.14      if ( xc_domain_dumpcore(xc->xc_handle, dom, corefile) != 0 )
    1.15          return PyErr_SetFromErrno(xc_error);
    1.16      
    1.17      Py_INCREF(zero);
    1.18      return zero;
    1.19 -
    1.20 - exit:
    1.21 -    return NULL;
    1.22  }
    1.23  
    1.24  static PyObject *pyxc_handle(PyObject *self)
    1.25 @@ -95,12 +92,7 @@ static PyObject *pyxc_domain_create(PyOb
    1.26      {
    1.27          if ( !PyList_Check(pyhandle) || 
    1.28               (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
    1.29 -        {
    1.30 -        out_exception:
    1.31 -            errno = EINVAL;
    1.32 -            PyErr_SetFromErrno(xc_error);
    1.33 -            return NULL;
    1.34 -        }
    1.35 +            goto out_exception;
    1.36  
    1.37          for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
    1.38          {
    1.39 @@ -115,6 +107,11 @@ static PyObject *pyxc_domain_create(PyOb
    1.40          return PyErr_SetFromErrno(xc_error);
    1.41  
    1.42      return PyInt_FromLong(dom);
    1.43 +
    1.44 +out_exception:
    1.45 +    errno = EINVAL;
    1.46 +    PyErr_SetFromErrno(xc_error);
    1.47 +    return NULL;
    1.48  }
    1.49  
    1.50  static PyObject *pyxc_domain_max_vcpus(PyObject *self,
    1.51 @@ -270,10 +267,7 @@ static PyObject *pyxc_domain_sethandle(P
    1.52      if ( !PyList_Check(pyhandle) || 
    1.53           (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
    1.54      {
    1.55 -    out_exception:
    1.56 -        errno = EINVAL;
    1.57 -        PyErr_SetFromErrno(xc_error);
    1.58 -        return NULL;
    1.59 +        goto out_exception;
    1.60      }
    1.61  
    1.62      for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
    1.63 @@ -289,8 +283,14 @@ static PyObject *pyxc_domain_sethandle(P
    1.64      
    1.65      Py_INCREF(zero);
    1.66      return zero;
    1.67 +
    1.68 +out_exception:
    1.69 +    errno = EINVAL;
    1.70 +    PyErr_SetFromErrno(xc_error);
    1.71 +    return NULL;
    1.72  }
    1.73  
    1.74 +
    1.75  static PyObject *pyxc_domain_getinfo(PyObject *self,
    1.76                                       PyObject *args,
    1.77                                       PyObject *kwds)