code cleanup: define sizes of vectors for function args and use C style comments
This commit is contained in:
@@ -284,7 +284,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
|
||||
if (PyList_GET_SIZE(cb_list) > 0) {
|
||||
PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
|
||||
PyObject *args = PyTuple_New(1); // save python creating each call
|
||||
PyObject *args = PyTuple_New(1); /* save python creating each call */
|
||||
PyObject *func;
|
||||
PyObject *ret;
|
||||
Py_ssize_t pos;
|
||||
|
||||
@@ -280,7 +280,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
|
||||
}
|
||||
|
||||
|
||||
#if 0 // slow, with this can avoid all Py_CompileString above.
|
||||
#if 0 /* slow, with this can avoid all Py_CompileString above. */
|
||||
/* execute expression to get a value */
|
||||
retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
|
||||
#else
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
#include "BPY_extern.h"
|
||||
|
||||
#include "../generic/bpy_internal_import.h" // our own imports
|
||||
#include "../generic/bpy_internal_import.h" /* our own imports */
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
/* inittab initialization functions */
|
||||
@@ -180,10 +180,10 @@ void BPY_text_free_code(Text *text)
|
||||
|
||||
void BPY_modules_update(bContext *C)
|
||||
{
|
||||
#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec.
|
||||
#if 0 /* slow, this runs all the time poll, draw etc 100's of time a sec. */
|
||||
PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
|
||||
PyModule_AddObject(mod, "data", BPY_rna_module());
|
||||
PyModule_AddObject(mod, "types", BPY_rna_types()); // atm this does not need updating
|
||||
PyModule_AddObject(mod, "types", BPY_rna_types()); /* atm this does not need updating */
|
||||
#endif
|
||||
|
||||
/* refreshes the main struct */
|
||||
@@ -268,7 +268,7 @@ void BPY_python_start(int argc, const char **argv)
|
||||
|
||||
Py_Initialize();
|
||||
|
||||
// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
|
||||
// PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */
|
||||
/* sigh, why do python guys not have a (char **) version anymore? */
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -81,7 +81,7 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
|
||||
short BPy_errors_to_report(ReportList *reports)
|
||||
{
|
||||
PyObject *pystring;
|
||||
PyObject *pystring_format = NULL; // workaround, see below
|
||||
PyObject *pystring_format = NULL; /* workaround, see below */
|
||||
char *cstring;
|
||||
|
||||
const char *filename;
|
||||
@@ -110,17 +110,18 @@ short BPy_errors_to_report(ReportList *reports)
|
||||
|
||||
cstring = _PyUnicode_AsString(pystring);
|
||||
|
||||
#if 0 // ARG!. workaround for a bug in blenders use of vsnprintf
|
||||
#if 0 /* ARG!. workaround for a bug in blenders use of vsnprintf */
|
||||
BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno);
|
||||
#else
|
||||
pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
|
||||
cstring = _PyUnicode_AsString(pystring_format);
|
||||
BKE_report(reports, RPT_ERROR, cstring);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno); // not exactly needed. just for testing
|
||||
|
||||
|
||||
/* not exactly needed. just for testing */
|
||||
fprintf(stderr, TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
|
||||
|
||||
Py_DECREF(pystring);
|
||||
Py_DECREF(pystring_format); // workaround
|
||||
Py_DECREF(pystring_format); /* workaround */
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user