fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions.
- use NULL rather then 0 where possible (makes code & function calls more readable IMHO). - set static variables and functions (exposed some unused vars/funcs). - use func(void) rather then func() for definitions.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#define WITH_PYTHON /* for AUD_PyInit.h, possibly others */
|
||||
|
||||
#include "bpy.h"
|
||||
#include "bpy_util.h"
|
||||
#include "bpy_rna.h"
|
||||
#include "bpy_app.h"
|
||||
@@ -58,7 +59,7 @@ static char bpy_script_paths_doc[] =
|
||||
" :return: (system, user) strings will be empty when not found.\n"
|
||||
" :rtype: tuple of strigs\n";
|
||||
|
||||
PyObject *bpy_script_paths(PyObject *UNUSED(self))
|
||||
static PyObject *bpy_script_paths(PyObject *UNUSED(self))
|
||||
{
|
||||
PyObject *ret= PyTuple_New(2);
|
||||
char *path;
|
||||
|
||||
@@ -64,7 +64,7 @@ static PyStructSequence_Field app_info_fields[] = {
|
||||
{(char *)"build_cxxflags", (char *)"C++ compiler flags"},
|
||||
{(char *)"build_linkflags", (char *)"Binary linking flags"},
|
||||
{(char *)"build_system", (char *)"Build system used"},
|
||||
{0}
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static PyStructSequence_Desc app_info_desc = {
|
||||
@@ -192,7 +192,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl
|
||||
}
|
||||
|
||||
|
||||
PyGetSetDef bpy_app_getsets[]= {
|
||||
static PyGetSetDef bpy_app_getsets[]= {
|
||||
{(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)"Boolean, set when blender is running in debug mode (started with -d)", NULL},
|
||||
{(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)"Int, number which can be set to non-zero values for testing purposes.", NULL},
|
||||
{(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)"String, the temp directory used by blender (read-only)", NULL},
|
||||
|
||||
@@ -151,7 +151,7 @@ void BPY_modules_update(bContext *C)
|
||||
}
|
||||
|
||||
/* must be called before Py_Initialize */
|
||||
void BPY_python_start_path(void)
|
||||
static void bpy_python_start_path(void)
|
||||
{
|
||||
char *py_path_bundle= BLI_get_folder(BLENDER_PYTHON, NULL);
|
||||
|
||||
@@ -228,7 +228,7 @@ void BPY_python_start( int argc, char **argv )
|
||||
/* builtin modules */
|
||||
PyImport_ExtendInittab(bpy_internal_modules);
|
||||
|
||||
BPY_python_start_path(); /* allow to use our own included python */
|
||||
bpy_python_start_path(); /* allow to use our own included python */
|
||||
|
||||
/* Python 3.2 now looks for '2.56/python/include/python3.2d/pyconfig.h' to parse
|
||||
* from the 'sysconfig' module which is used by 'site', so for now disable site.
|
||||
|
||||
@@ -37,19 +37,19 @@
|
||||
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
EnumPropertyItem property_flag_items[] = {
|
||||
static EnumPropertyItem property_flag_items[] = {
|
||||
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
|
||||
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem property_flag_enum_items[] = {
|
||||
static EnumPropertyItem property_flag_enum_items[] = {
|
||||
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
|
||||
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
|
||||
{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
/* subtypes */
|
||||
EnumPropertyItem property_subtype_string_items[] = {
|
||||
static EnumPropertyItem property_subtype_string_items[] = {
|
||||
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
|
||||
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
|
||||
{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
|
||||
@@ -57,7 +57,7 @@ EnumPropertyItem property_subtype_string_items[] = {
|
||||
{PROP_NONE, "NONE", 0, "None", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem property_subtype_number_items[] = {
|
||||
static EnumPropertyItem property_subtype_number_items[] = {
|
||||
{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
|
||||
{PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
|
||||
{PROP_FACTOR, "FACTOR", 0, "Factor", ""},
|
||||
@@ -68,7 +68,7 @@ EnumPropertyItem property_subtype_number_items[] = {
|
||||
{PROP_NONE, "NONE", 0, "None", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem property_subtype_array_items[] = {
|
||||
static EnumPropertyItem property_subtype_array_items[] = {
|
||||
{PROP_COLOR, "COLOR", 0, "Color", ""},
|
||||
{PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
|
||||
{PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
|
||||
|
||||
@@ -228,7 +228,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
|
||||
return 1;
|
||||
}
|
||||
|
||||
Mathutils_Callback mathutils_rna_array_cb = {
|
||||
static Mathutils_Callback mathutils_rna_array_cb = {
|
||||
(BaseMathCheckFunc) mathutils_rna_generic_check,
|
||||
(BaseMathGetFunc) mathutils_rna_vector_get,
|
||||
(BaseMathSetFunc) mathutils_rna_vector_set,
|
||||
@@ -278,7 +278,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
|
||||
return 1;
|
||||
}
|
||||
|
||||
Mathutils_Callback mathutils_rna_matrix_cb = {
|
||||
static Mathutils_Callback mathutils_rna_matrix_cb = {
|
||||
mathutils_rna_generic_check,
|
||||
mathutils_rna_matrix_get,
|
||||
mathutils_rna_matrix_set,
|
||||
@@ -1221,7 +1221,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
||||
else {
|
||||
/* data==NULL, assign to RNA */
|
||||
if(value == Py_None) {
|
||||
PointerRNA valueptr= {{0}};
|
||||
PointerRNA valueptr= {{NULL}};
|
||||
RNA_property_pointer_set(ptr, prop, valueptr);
|
||||
}
|
||||
else if(RNA_struct_is_a(param->ptr.type, ptype)) {
|
||||
@@ -3572,7 +3572,7 @@ static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObj
|
||||
|
||||
/* A bit of a kludge, make a list out of a collection or array,
|
||||
* then return the lists iter function, not especially fast but convenient for now */
|
||||
PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
|
||||
static PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
|
||||
{
|
||||
/* Try get values from a collection */
|
||||
PyObject *ret;
|
||||
@@ -3590,7 +3590,7 @@ PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
|
||||
return iter;
|
||||
}
|
||||
|
||||
PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
|
||||
static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
|
||||
{
|
||||
/* Try get values from a collection */
|
||||
PyObject *ret;
|
||||
@@ -3719,7 +3719,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *U
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
|
||||
static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
|
||||
{
|
||||
PyObject *ret;
|
||||
int type = RNA_property_type(prop);
|
||||
@@ -4475,7 +4475,7 @@ PyTypeObject pyrna_prop_collection_Type = {
|
||||
};
|
||||
|
||||
/* only for add/remove/move methods */
|
||||
PyTypeObject pyrna_prop_collection_idprop_Type = {
|
||||
static PyTypeObject pyrna_prop_collection_idprop_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"bpy_prop_collection_idprop", /* tp_name */
|
||||
sizeof( BPy_PropertyRNA ), /* tp_basicsize */
|
||||
@@ -4941,7 +4941,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
|
||||
return list;
|
||||
}
|
||||
|
||||
PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE;
|
||||
static PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE;
|
||||
|
||||
PyObject *BPY_rna_types(void)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
#include "bpy_rna.h"
|
||||
#include "bpy_rna_callback.h"
|
||||
#include "bpy_util.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -37,7 +38,7 @@
|
||||
#define RNA_CAPSULE_ID "RNA_HANDLE"
|
||||
#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
|
||||
|
||||
void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
|
||||
static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
|
||||
{
|
||||
PyObject *cb_func, *cb_args, *result;
|
||||
PyGILState_STATE gilstate;
|
||||
|
||||
@@ -25,5 +25,5 @@
|
||||
struct BPy_StructRNA;
|
||||
struct PyObject;
|
||||
|
||||
struct PyObject *pyrna_callback_add(struct BPy_StructRNA *self, struct PyObject *args);
|
||||
struct PyObject *pyrna_callback_remove(struct BPy_StructRNA *self, struct PyObject *args);
|
||||
PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args);
|
||||
PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
bContext* __py_context = NULL;
|
||||
static bContext* __py_context = NULL;
|
||||
bContext* BPy_GetContext(void) { return __py_context; }
|
||||
void BPy_SetContext(bContext *C) { __py_context= C; }
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
|
||||
char *BPy_enum_as_string(struct EnumPropertyItem *item);
|
||||
|
||||
|
||||
#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL}
|
||||
|
||||
/* error reporting */
|
||||
short BPy_reports_to_error(struct ReportList *reports, const short clear);
|
||||
|
||||
Reference in New Issue
Block a user