diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-13 13:52:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-13 13:52:18 +0300 |
commit | 0955c664aa7c5fc5f0bd345c58219c40f04ab9c1 (patch) | |
tree | 20b6a2ab2e1130d75d119eba09f3b195a33a9434 /source/blender/blenlib/intern | |
parent | f3bd89b1b7a86778ff4c633a6b4115309a1b3c7e (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/BLI_args.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_heap.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdtree.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/freetypefont.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/graph.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 14 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 2 |
12 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index ff41f76a1f9..4a62e9d26fd 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -39,7 +39,7 @@ #include "BLI_args.h" #include "BLI_ghash.h" -char NO_DOCS[] = "NO DOCUMENTATION SPECIFIED"; +static char NO_DOCS[] = "NO DOCUMENTATION SPECIFIED"; struct bArgDoc; typedef struct bArgDoc { diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index a8ca828aa66..541b9ea0ae8 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -90,7 +90,7 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef MEM_freeN(gh->buckets); BLI_mempool_destroy(gh->entrypool); - gh->buckets = 0; + gh->buckets = NULL; gh->nentries = 0; gh->nbuckets = 0; MEM_freeN(gh); diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index f6616ecb06b..7d77e85bfe1 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -64,7 +64,7 @@ struct Heap { /***/ -Heap *BLI_heap_new() +Heap *BLI_heap_new(void) { Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap"); heap->bufsize = 1; diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 4673462f58b..d85950ce22d 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -161,7 +161,7 @@ static float KDOP_AXES[13][3] = heap[parent] = element; \ } -int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) +static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) { int new_max_size = *max_size * 2; void *new_memblock = NULL; @@ -1137,11 +1137,11 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int // check for compatibility of both trees (can't compare 14-DOP with 18-DOP) if((tree1->axis != tree2->axis) && (tree1->axis == 14 || tree2->axis == 14) && (tree1->axis == 18 || tree2->axis == 18)) - return 0; + return NULL; // fast check root nodes for collision before doing big splitting + traversal if(!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], MIN2(tree1->start_axis, tree2->start_axis), MIN2(tree1->stop_axis, tree2->stop_axis))) - return 0; + return NULL; data = MEM_callocN(sizeof(BVHOverlapData *)* tree1->tree_type, "BVHOverlapData_star"); diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 0d541c1fe37..8902c580493 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -255,7 +255,7 @@ static void add_nearest(KDTreeNearest *ptn, int *found, int n, int index, float /* finds the nearest n entries in tree to specified coordinates */ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest) { - KDTreeNode *root, *node=0; + KDTreeNode *root, *node= NULL; KDTreeNode **stack, *defaultstack[100]; float cur_dist; int i, totstack, cur=0, found=0; @@ -370,7 +370,7 @@ static void add_in_range(KDTreeNearest **ptn, int found, int *totfoundstack, int } int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KDTreeNearest **nearest) { - KDTreeNode *root, *node=0; + KDTreeNode *root, *node= NULL; KDTreeNode **stack, *defaultstack[100]; KDTreeNearest *foundstack=NULL; float range2 = range*range, dist2; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index b1e5561b0cd..10ee18d5142 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -141,7 +141,7 @@ void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const ch BLI_bpathIterator_step(bpi); } -void BLI_bpathIterator_alloc(struct BPathIterator **bpi) { +static void BLI_bpathIterator_alloc(struct BPathIterator **bpi) { *bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc"); } @@ -797,7 +797,7 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char dir= opendir(dirname); - if (dir==0) + if (dir==NULL) return 0; if (*filesize == -1) diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 482ca1c01e5..b34dbb2d5fd 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -367,7 +367,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) // No charmap found from the ttf so we need to figure it out if(glyph_index == 0) { - FT_CharMap found = 0; + FT_CharMap found = NULL; FT_CharMap charmap; int n; @@ -477,7 +477,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf) err = FT_Init_FreeType( &library); if(err) { //XXX error("Failed to load the Freetype font library"); - return 0; + return NULL; } success = check_freetypefont(pf); diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index e187595aa11..0137826df64 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -296,7 +296,7 @@ BNode * BLI_FindNodeByPosition(BGraph *graph, float *p, float limit) } /************************************* SUBGRAPH DETECTION **********************************************/ -void flagSubgraph(BNode *node, int subgraph) +static void flagSubgraph(BNode *node, int subgraph) { if (node->subgraph_index == 0) { @@ -425,7 +425,7 @@ BArc * BLI_findConnectedArc(BGraph *graph, BArc *arc, BNode *v) /*********************************** GRAPH AS TREE FUNCTIONS *******************************************/ -int subtreeShape(BNode *node, BArc *rootArc, int include_root) +static int subtreeShape(BNode *node, BArc *rootArc, int include_root) { int depth = 0; diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index b8b0b5b6eda..975479a3875 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -48,9 +48,9 @@ /* Ripped this from blender.c */ void BLI_movelisttolist(ListBase *dst, ListBase *src) { - if (src->first==0) return; + if (src->first==NULL) return; - if (dst->first==0) { + if (dst->first==NULL) { dst->first= src->first; dst->last= src->last; } @@ -59,7 +59,7 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src) ((Link *)src->first)->prev= dst->last; dst->last= src->last; } - src->first= src->last= 0; + src->first= src->last= NULL; } void BLI_addhead(ListBase *listbase, void *vlink) @@ -89,7 +89,7 @@ void BLI_addtail(ListBase *listbase, void *vlink) link->prev = listbase->last; if (listbase->last) ((Link *)listbase->last)->next = link; - if (listbase->first == 0) listbase->first = link; + if (listbase->first == NULL) listbase->first = link; listbase->last = link; } @@ -152,7 +152,7 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink) /* insert before first element */ if (prevlink == NULL) { newlink->next= listbase->first; - newlink->prev= 0; + newlink->prev= NULL; newlink->next->prev= newlink; listbase->first= newlink; return; @@ -251,7 +251,7 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) /* insert at end of list */ if (nextlink == NULL) { newlink->prev= listbase->last; - newlink->next= 0; + newlink->next= NULL; ((Link *)listbase->last)->next= newlink; listbase->last= newlink; return; @@ -422,7 +422,7 @@ void BLI_duplicatelist(ListBase *dst, const ListBase *src) /* in this order, to ensure it works if dst == src */ src_link= src->first; - dst->first= dst->last= 0; + dst->first= dst->last= NULL; while(src_link) { dst_link= MEM_dupallocN(src_link); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index d7a71f8567c..bb5b3a21770 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2080,7 +2080,7 @@ pointers may be NULL if not needed */ /* can't believe there is none in math utils */ -float _det_m3(float m2[3][3]) +static float _det_m3(float m2[3][3]) { float det = 0.f; if (m2){ diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 75134358c31..413ac57dea5 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -242,7 +242,7 @@ void mul_serie_m3(float answ[][3], { float temp[3][3]; - if(m1==0 || m2==0) return; + if(m1==NULL || m2==NULL) return; mul_m3_m3m3(answ, m2, m1); if(m3) { @@ -275,7 +275,7 @@ void mul_serie_m4(float answ[][4], float m1[][4], { float temp[4][4]; - if(m1==0 || m2==0) return; + if(m1==NULL || m2==NULL) return; mul_m4_m4m4(answ, m2, m1); if(m3) { @@ -1708,5 +1708,5 @@ void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon) transpose_m4(V); - mul_serie_m4(Ainv, U, Wm, V, 0, 0, 0, 0, 0); + mul_serie_m4(Ainv, U, Wm, V, NULL, NULL, NULL, NULL, NULL); } diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 2038121e3f2..291e7babdbb 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1431,7 +1431,7 @@ void mat4_to_dquat(DualQuat *dq,float basemat[][4], float mat[][4]) mul_m4_m4m4(S, baseRS, baseRinv); /* set scaling part */ - mul_serie_m4(dq->scale, basemat, S, baseinv, 0, 0, 0, 0, 0); + mul_serie_m4(dq->scale, basemat, S, baseinv, NULL, NULL, NULL, NULL, NULL); dq->scale_weight= 1.0f; } else { |