From fa2ba5fbf5848e4d61b697c624af9b9e9456eb20 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 05:06:30 +0000 Subject: - use static vars and functions where possible. - use NULL rather than 0 when used as pointers. --- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_main_api.c | 1 + source/blender/makesrna/intern/rna_modifier.c | 1 + source/blender/makesrna/intern/rna_nodetree.c | 2 +- source/blender/makesrna/intern/rna_object_force.c | 17 +++++++++-------- source/blender/makesrna/intern/rna_particle.c | 17 +++++++++-------- source/blender/makesrna/intern/rna_texture.c | 3 ++- 7 files changed, 24 insertions(+), 19 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index d47abced85e..b95bd2b2087 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -66,7 +66,7 @@ static int file_older(const char *file1, const char *file2) return (st1.st_mtime < st2.st_mtime); } -const char *makesrna_path= NULL; +static const char *makesrna_path= NULL; static int replace_if_different(char *tmpfile, const char *dep_files[]) { diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 8ac620c2fcf..ea0364084f9 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -38,6 +38,7 @@ #include "RNA_define.h" #include "RNA_access.h" #include "RNA_enum_types.h" +#include "rna_internal.h" #include "BKE_utildefines.h" diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 5c5391b0bba..37a629f46d0 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -32,6 +32,7 @@ #include #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7fd6a9dacfe..56492a52da9 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -732,7 +732,7 @@ static StructRNA* def_node(BlenderRNA *brna, int node_id) return srna; } -void alloc_node_type_items(EnumPropertyItem *items, int category) +static void alloc_node_type_items(EnumPropertyItem *items, int category) { int i; int count = 3; diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 463f65fd3d5..490d9c38840 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -43,7 +43,7 @@ #include "WM_api.h" #include "WM_types.h" -EnumPropertyItem effector_shape_items[] = { +static EnumPropertyItem effector_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""}, @@ -51,20 +51,23 @@ EnumPropertyItem effector_shape_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem curve_shape_items[] = { +#ifdef RNA_RUNTIME + +/* type spesific return values only used from functions */ +static EnumPropertyItem curve_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem empty_shape_items[] = { +static EnumPropertyItem empty_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem vortex_shape_items[] = { +static EnumPropertyItem vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""}, @@ -72,21 +75,19 @@ EnumPropertyItem vortex_shape_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem curve_vortex_shape_items[] = { +static EnumPropertyItem curve_vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem empty_vortex_shape_items[] = { +static EnumPropertyItem empty_vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} }; -#ifdef RNA_RUNTIME - #include "MEM_guardedalloc.h" #include "DNA_modifier_types.h" diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 30fce5716a9..ba91fc3536b 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -33,6 +33,7 @@ #include "limits.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -50,34 +51,34 @@ #include "WM_types.h" #include "WM_api.h" -EnumPropertyItem part_from_items[] = { +static EnumPropertyItem part_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_reactor_from_items[] = { +static EnumPropertyItem part_reactor_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_dist_items[] = { +static EnumPropertyItem part_dist_items[] = { {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {PART_DISTR_GRID, "GRID", 0, "Grid", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_hair_dist_items[] = { +static EnumPropertyItem part_hair_dist_items[] = { {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_draw_as_items[] = { +static EnumPropertyItem part_draw_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_REND, "RENDER", 0, "Rendered", ""}, {PART_DRAW_DOT, "DOT", 0, "Point", ""}, @@ -87,14 +88,14 @@ EnumPropertyItem part_draw_as_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_hair_draw_as_items[] = { +static EnumPropertyItem part_hair_draw_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_REND, "RENDER", 0, "Rendered", ""}, {PART_DRAW_PATH, "PATH", 0, "Path", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_ren_as_items[] = { +static EnumPropertyItem part_ren_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_HALO, "HALO", 0, "Halo", ""}, {PART_DRAW_LINE, "LINE", 0, "Line", ""}, @@ -105,7 +106,7 @@ EnumPropertyItem part_ren_as_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_hair_ren_as_items[] = { +static EnumPropertyItem part_hair_ren_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_PATH, "PATH", 0, "Path", ""}, {PART_DRAW_OB, "OBJECT", 0, "Object", ""}, diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index f459563f49e..0ecc41d80d8 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -32,6 +32,7 @@ #include #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -47,7 +48,7 @@ #include "BKE_node.h" -EnumPropertyItem texture_filter_items[] = { +static EnumPropertyItem texture_filter_items[] = { {TXF_BOX, "BOX", 0, "Box", ""}, {TXF_EWA, "EWA", 0, "EWA", ""}, {TXF_FELINE, "FELINE", 0, "FELINE", ""}, -- cgit v1.2.3