LVM_VALID();
- if((info = PyTuple_New(2)) == NULL)
+ if ((info = PyTuple_New(2)) == NULL)
return NULL;
PyTuple_SetItem(info, 0, PyInt_FromLong((long) lvm_errno(libh)));
if (!PyArg_ParseTuple(arg, "s", &pvid))
return NULL;
- if((vgname = lvm_vgname_from_pvid(libh, pvid)) == NULL) {
+ if ((vgname = lvm_vgname_from_pvid(libh, pvid)) == NULL) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
if (!PyArg_ParseTuple(arg, "s", &device))
return NULL;
- if((vgname = lvm_vgname_from_device(libh, device)) == NULL) {
+ if ((vgname = lvm_vgname_from_device(libh, device)) == NULL) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
LVM_VALID();
- if((rval = lvm_config_reload(libh)) == -1) {
+ if ((rval = lvm_config_reload(libh)) == -1) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
LVM_VALID();
- if((rval = lvm_scan(libh)) == -1) {
+ if ((rval = lvm_scan(libh)) == -1) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
PyObject *pytuple;
PyObject *setable;
- if( !prop->is_valid ) {
+ if (!prop->is_valid) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
if (!pytuple)
return NULL;
- if( prop->is_integer ) {
+ if (prop->is_integer) {
PyTuple_SET_ITEM(pytuple, 0, Py_BuildValue("K", prop->value.integer));
} else {
PyTuple_SET_ITEM(pytuple, 0, PyString_FromString(prop->value.string));
lvm_property = lvm_vg_get_property(self->vg, property_name);
- if( !lvm_property.is_valid ) {
+ if (!lvm_property.is_valid ) {
goto lvmerror;
}
- if(PyObject_IsInstance(variant_type_arg, (PyObject*)&PyString_Type)) {
+ if (PyObject_IsInstance(variant_type_arg, (PyObject*)&PyString_Type)) {
if (!lvm_property.is_string) {
PyErr_Format(PyExc_ValueError, "Property requires string value");
leak when calling into set_property, need to verify*/
string_value = strdup(PyString_AsString(variant_type_arg));
lvm_property.value.string = string_value;
- if(!lvm_property.value.string) {
+ if (!lvm_property.value.string) {
PyErr_NoMemory();
goto bail;
}
goto bail;
}
- if(PyObject_IsInstance(variant_type_arg, (PyObject*)&PyInt_Type)) {
+ if (PyObject_IsInstance(variant_type_arg, (PyObject*)&PyInt_Type)) {
int temp_py_int = PyInt_AsLong(variant_type_arg);
/* -1 could be valid, need to see if an exception was gen. */
- if( -1 == temp_py_int ) {
- if( PyErr_Occurred() ) {
- goto bail;
- }
+ if (temp_py_int == -1 && PyErr_Occurred()) {
+ goto bail;
}
if (temp_py_int < 0) {
}
lvm_property.value.integer = temp_py_int;
- } else if(PyObject_IsInstance(variant_type_arg, (PyObject*)&PyLong_Type)){
+ } else if (PyObject_IsInstance(variant_type_arg, (PyObject*)&PyLong_Type)){
/* This will fail on negative numbers */
unsigned long long temp_py_long = PyLong_AsUnsignedLongLong(variant_type_arg);
- if( (unsigned long long)-1 == temp_py_long ) {
+ if (temp_py_long == (unsigned long long)-1) {
goto bail;
}
}
}
- if( -1 == lvm_vg_set_property(self->vg, property_name, &lvm_property) ) {
+ if (lvm_vg_set_property(self->vg, property_name, &lvm_property) == -1) {
goto lvmerror;
}
- if( -1 == lvm_vg_write(self->vg)) {
+ if (lvm_vg_write(self->vg) == -1) {
goto lvmerror;
}
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
bail:
free(string_value);
- if( variant_type_arg ) {
+ if (variant_type_arg) {
Py_DECREF(variant_type_arg);
variant_type_arg = NULL;
}
return NULL;
lv = method(self->vg, id);
- if( !lv ) {
+ if (!lv) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
rc = PyObject_New(lvobject, &LibLVMlvType);
- if( !rc ) {
+ if (!rc) {
return NULL;
}
return NULL;
pv = method(self->vg, id);
- if( !pv ) {
+ if (!pv) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
return NULL;
}
rc = PyObject_New(pvobject, &LibLVMpvType);
- if( !rc ) {
+ if (!rc) {
return NULL;
}
LV_VALID(lv);
lvsegs = lvm_lv_list_lvsegs(lv->lv);
- if(!lvsegs) {
+ if (!lvsegs) {
return Py_BuildValue("()");
}
PV_VALID(pv);
pvsegs = lvm_pv_list_pvsegs(pv->pv);
- if(!pvsegs) {
+ if (!pvsegs) {
return Py_BuildValue("()");
}