code cleanup: more confusion with 0/NULL/false

This commit is contained in:
Campbell Barton 2013-08-07 03:55:21 +00:00
parent 4f29aeeff2
commit 00b39c4e5b
15 changed files with 28 additions and 27 deletions

View File

@ -2635,9 +2635,9 @@ void DM_add_tangent_layer(DerivedMesh *dm)
/* new computation method */
{
SGLSLMeshToTangent mesh2tangent = {0};
SMikkTSpaceContext sContext = {0};
SMikkTSpaceInterface sInterface = {0};
SGLSLMeshToTangent mesh2tangent = {NULL};
SMikkTSpaceContext sContext = {NULL};
SMikkTSpaceInterface sInterface = {NULL};
mesh2tangent.precomputedFaceNormals = nors;
mesh2tangent.mtface = mtface;

View File

@ -1064,7 +1064,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
const float (*vertexNos)[3];
const float (*polyNos)[3];
BMFace *efa;
DMVertexAttribs attribs = {{{0}}};
DMVertexAttribs attribs = {{{NULL}}};
GPUVertexAttribs gattribs;
int i, matnr, new_matnr;

View File

@ -190,7 +190,8 @@ Key *BKE_key_copy_nolib(Key *key)
Key *keyn;
KeyBlock *kbn, *kb;
if (key == 0) return 0;
if (key == NULL)
return NULL;
keyn = MEM_dupallocN(key);

View File

@ -245,7 +245,7 @@ static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level)
{
MDisps *mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS,
CD_CALLOC, 0, me->totloop);
CD_CALLOC, NULL, me->totloop);
int gridsize = ccg_gridsize(level);
int gridarea = gridsize * gridsize;
int i, j, k;

View File

@ -838,12 +838,12 @@ static void free_tree(node_tree *tree)
{
if (tree->left) {
free_tree(tree->left);
tree->left = 0;
tree->left = NULL;
}
if (tree->right) {
free_tree(tree->right);
tree->right = 0;
tree->right = NULL;
}
free(tree);
@ -860,7 +860,7 @@ static void BKE_pbvh_search_callback_occluded(PBVH *bvh,
{
PBVHIter iter;
PBVHNode *node;
node_tree *tree = 0;
node_tree *tree = NULL;
pbvh_iter_begin(&iter, bvh, scb, search_data);
@ -1356,7 +1356,7 @@ void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *pro
if (proxy_count) *proxy_count = node->proxy_count;
}
else {
if (proxies) *proxies = 0;
if (proxies) *proxies = NULL;
if (proxy_count) *proxy_count = 0;
}
}
@ -1788,11 +1788,11 @@ void BKE_pbvh_node_free_proxies(PBVHNode *node)
for (p = 0; p < node->proxy_count; p++) {
MEM_freeN(node->proxies[p].co);
node->proxies[p].co = 0;
node->proxies[p].co = NULL;
}
MEM_freeN(node->proxies);
node->proxies = 0;
node->proxies = NULL;
node->proxy_count = 0;
}
@ -1836,10 +1836,10 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
int *grid_indices, *vert_indices;
int totgrid, gridsize, uniq_verts, totvert;
vi->grid = 0;
vi->no = 0;
vi->fno = 0;
vi->mvert = 0;
vi->grid = NULL;
vi->no = NULL;
vi->fno = NULL;
vi->mvert = NULL;
BKE_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL);
BKE_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);

View File

@ -3139,7 +3139,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
int numTex, numCol;
int hasPCol, hasOrigSpace;
int gridInternalEdges;
WeightTable wtable = {0};
WeightTable wtable = {NULL};
/* MCol *mcol; */ /* UNUSED */
MEdge *medge = NULL;
/* MFace *mface = NULL; */

View File

@ -57,7 +57,7 @@ enum {
BLI_Buffer name_ = { \
/* clear the static memory if this is a calloc'd array */ \
((void)((flag_ & BLI_BUFFER_USE_CALLOC) ? \
memset(name_ ## _static_, 0, sizeof(name_ ## _static_)) : 0\
memset(name_ ## _static_, 0, sizeof(name_ ## _static_)) : NULL \
), /* memset-end */ \
name_ ## _static_), \
sizeof(type_), \

View File

@ -220,7 +220,7 @@ static void init_laplacian_matrix(LaplacianSystem *sys)
v1 = vf[0]->co;
v2 = vf[1]->co;
v3 = vf[2]->co;
v4 = has_4_vert ? vf[3]->co : 0;
v4 = has_4_vert ? vf[3]->co : NULL;
if (has_4_vert) {
areaf = area_quad_v3(v1, v2, v3, v4);

View File

@ -345,7 +345,7 @@ static bool bm_decim_triangulate_begin(BMesh *bm)
}
#ifdef USE_SAFETY_CHECKS
if (BM_edge_exists(l_a->v, l_b->v) == false)
if (BM_edge_exists(l_a->v, l_b->v) == NULL)
#endif
{
BMFace *f_new;

View File

@ -461,7 +461,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op)
unsigned int lay = 0;
int nverts = 0, ntris = 0;
int *tris = 0;
int *tris = NULL;
float *verts = NULL;
createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay);

View File

@ -1336,7 +1336,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
const float mval_f[2] = {(float)mval[0],
(float)mval[1]};
VertPickData data = {0};
VertPickData data = {NULL};
ED_view3d_init_mats_rv3d(ob, rv3d);

View File

@ -1991,7 +1991,7 @@ static struct TransIslandData *editmesh_islands_info_calc(BMEditMesh *em, int *r
/* may be an edge OR a face array */
for (i = 0; i < group_tot; i++) {
BMEditSelection ese = {0};
BMEditSelection ese = {NULL};
const int fg_sta = group_index[i][0];
const int fg_len = group_index[i][1];
@ -6421,7 +6421,7 @@ void flushTransTracking(TransInfo *t)
}
}
if (tdt->area != TRACK_AREA_POINT || tdt->relative == 0) {
if (tdt->area != TRACK_AREA_POINT || tdt->relative == NULL) {
td2d->loc2d[0] = loc2d[0];
td2d->loc2d[1] = loc2d[1];

View File

@ -362,7 +362,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
ModifierData *md;
SubsurfModifierData *smd_real;
/* modifier initialization data, will control what type of subdivision will happen*/
SubsurfModifierData smd = {{0}};
SubsurfModifierData smd = {{NULL}};
/* Used to hold subsurfed Mesh */
DerivedMesh *derivedMesh, *initialDerived;
/* holds original indices for subsurfed mesh */

View File

@ -366,7 +366,7 @@ static void init_laplacian_matrix(LaplacianSystem *sys)
v1 = sys->vertexCos[idv1];
v2 = sys->vertexCos[idv2];
v3 = sys->vertexCos[idv3];
v4 = has_4_vert ? sys->vertexCos[idv4] : 0;
v4 = has_4_vert ? sys->vertexCos[idv4] : NULL;
if (has_4_vert) {
areaf = area_quad_v3(v1, v2, v3, sys->vertexCos[sys->mfaces[i].v4]);

View File

@ -1751,7 +1751,7 @@ static void skin_set_orig_indices(DerivedMesh *dm)
totpoly = dm->getNumPolys(dm);
orig = CustomData_add_layer(&dm->polyData, CD_ORIGINDEX,
CD_CALLOC, 0, totpoly);
CD_CALLOC, NULL, totpoly);
for (i = 0; i < totpoly; i++)
orig[i] = ORIGINDEX_NONE;
}