- Give code a round of indentation. Thank astyle, not me.

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@837 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-09 14:38:45 +00:00
parent aaf8e068d3
commit d3c7b46853
108 changed files with 3196 additions and 3180 deletions

View file

@ -39,9 +39,9 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio
PyObject* pUserCPUPolicyModule = PyImport_Import(pLoadmeStr);
Py_DECREF(pLoadmeStr);
if(pUserCPUPolicyModule == NULL)
if (pUserCPUPolicyModule == NULL)
throw MalformedPolicyException(get_exception_information().c_str());
// Dictionary with defined ``symbols'' for .pyc file
_upolicy_dict = PyModule_GetDict(pUserCPUPolicyModule);
assert(_upolicy_dict);
@ -66,24 +66,24 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio
PyTuple_SetItem(pAdapterCtorParam, 0, pCPUPolicyClass);
_adapter = PyInstance_New(pAdapterClass, pAdapterCtorParam, NULL);
Py_DECREF(pAdapterCtorParam);
Py_DECREF(pScriptAdapterModule);
if(_adapter == NULL)
if (_adapter == NULL)
throw MalformedPolicyException(get_exception_information().c_str());
// And now, who's your daddy, huh?
}
PythonCPUPolicy::~PythonCPUPolicy()
{
if(_adapter) Py_DECREF(_adapter);
if (_adapter) Py_DECREF(_adapter);
// We keep this alive until dtor time, because
// the user may have defined some static global-space
// variables and they make use of them.
if(_upolicy_dict) Py_DECREF(_upolicy_dict);
if (_upolicy_dict) Py_DECREF(_upolicy_dict);
}
void
@ -122,7 +122,7 @@ PythonCPUPolicy::sort_queue() const throw(UserInterruptException)
PyObject* retval = PyObject_CallMethod(_adapter, "async_sort_queue", NULL);
// Do minimal debugging
if(!retval) PyErr_Print();
if (!retval) PyErr_Print();
else Py_DECREF(retval);
wait_unlock();
@ -163,9 +163,9 @@ int
PythonCPUPolicy::get_time_slice() const throw(UserInterruptException)
{
PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL);
// Do minimal debugging
if(!retval) PyErr_Print();
if (!retval) PyErr_Print();
else Py_DECREF(retval);
wait_unlock();
@ -193,13 +193,13 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException)
Py_UNBLOCK_THREADS;
usleep(WAIT_FOR); // hack'a'ton! magggggiccc nummmbeeerrrrrs!!
Py_BLOCK_THREADS;
PyObject* retval = PyObject_CallMethod(_adapter, "mutex_test_lock", NULL);
assert(retval);
still_locked = PyObject_IsTrue(retval);
Py_DECREF(retval);
if(i++ > 12) /* waits for WAIT_FOR * 12 microseconds == 3 secs */
if (i++ > 12) /* waits for WAIT_FOR * 12 microseconds == 3 secs */
{
PyThreadState_Clear(_save);
// As the API documentation says, the caller of PyEval_RestoreThread
@ -209,10 +209,10 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException)
throw UserInterruptException(_("User-defined policy is "
"taking too long to terminate."));
"taking too long to terminate."));
}
}
while(still_locked);
while (still_locked);
// What we should really do here:
/* do {
@ -234,9 +234,9 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException)
string
PythonCPUPolicy::get_exception_information()
{
if(PyErr_Occurred() == NULL)
if (PyErr_Occurred() == NULL)
return _("no error");
PyObject* pType = NULL;
PyObject* pValue = NULL;
PyObject* pTraceback = NULL;
@ -245,7 +245,7 @@ PythonCPUPolicy::get_exception_information()
string msg;
if(pValue != NULL)
if (pValue != NULL)
{
PyObject* pValueStr = PyObject_Str(pValue);
@ -256,9 +256,9 @@ PythonCPUPolicy::get_exception_information()
else
msg = string(_("no available information for this error"));
if(pType != NULL) Py_DECREF(pType);
if(pValue != NULL) Py_DECREF(pValue);
if(pTraceback != NULL) Py_DECREF(pTraceback);
if (pType != NULL) Py_DECREF(pType);
if (pValue != NULL) Py_DECREF(pValue);
if (pTraceback != NULL) Py_DECREF(pTraceback);
return msg;
}