diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-27 16:21:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-27 16:21:13 +0400 |
commit | 2ab62ce126651c600a8039de0dd95a4e3c02ea47 (patch) | |
tree | 7bd05d0ffa253332de7328d77e0d712fea6ae880 /source/blender/blenkernel | |
parent | aa6301674471500f74d3984d6d17d82ad5e8724f (diff) |
code cleanup: defines with braces - end with '(void)0' so callers must end with ';' like normal function.
... without this some editors dont parse the source so well.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_validate.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 45 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 11 |
5 files changed, 41 insertions, 29 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index e4309a64e56..d26a722b628 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -275,9 +275,9 @@ static int ccg_edgebase(int level) /***/ -#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } -#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } -#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } +#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } (void)0 +#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } (void)0 +#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } (void)0 /***/ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 25e34bf1879..26516b62aa3 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1310,7 +1310,7 @@ void clear_id_newpoins(void) } } -#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } +#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } (void)0 static void lib_indirect_test_id(ID *id, Library *lib) { diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index a60bb98ac18..669ae4f198a 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -103,11 +103,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, MDeformVert *dverts, /* assume totvert length */ const short do_verbose, const short do_fixes) { -# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } +# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0 # define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1) -# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } -# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } +# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0 +# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0 MVert *mv = mverts; MEdge *me; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 66dd23e76b9..cd5efb9951b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3751,9 +3751,14 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co return 1; } -#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } -#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } -#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } +#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \ + if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \ + if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \ + if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra) { @@ -3884,26 +3889,26 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex else ptex->time = texture_value_blend(def, ptex->time, value, mtex->timefac, blend); } - SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac) - SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac) - SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac) - SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac) - SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac) - SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac) - SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac) - SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac) + SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac); + SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac); + SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac); + SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac); + SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac); + SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac); + SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac); + SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac); } } - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length); } /************************************************/ /* Particle State */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 90d17e53349..91023513d4d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -99,8 +99,15 @@ # include "BLI_winstuff.h" #endif -#define PTCACHE_DATA_FROM(data, type, from) if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); } -#define PTCACHE_DATA_TO(data, type, index, to) if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); } +#define PTCACHE_DATA_FROM(data, type, from) \ + if (data[type]) { \ + memcpy(data[type], from, ptcache_data_size[type]); \ + } (void)0 + +#define PTCACHE_DATA_TO(data, type, index, to) \ + if (data[type]) { \ + memcpy(to, (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), ptcache_data_size[type]); \ + } (void)0 /* could be made into a pointcache option */ #define DURIAN_POINTCACHE_LIB_OK 1 |