diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-01-27 15:21:14 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-01-27 15:21:14 +0300 |
commit | 8fa9a916395652cab6c4fcebb17be677fd6091d1 (patch) | |
tree | e3eb9a430ce5094b100ec5d5ac8c11a0cfa70bb0 /source/blender/blenkernel/intern/particle_system.c | |
parent | 40b4471de700b4b13131a91a8dc9e87a8a8c8bc5 (diff) |
Fixing some clang reported issues in particle code.
* Not really bugs, but some code cleanup and clarification.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 62bfde601f6..e35504d73d7 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -223,6 +223,15 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles"); if(psys->part->phystype == PART_PHYS_BOIDS) newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles"); + + if(ELEM(NULL, newpars, newboids)) { + /* allocation error! */ + if(newpars) + MEM_freeN(newpars); + if(newboids) + MEM_freeN(newboids); + return; + } } if(psys->particles) { @@ -3402,8 +3411,6 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) BoidBrainData bbd; PARTICLE_P; float timestep; - /* current time */ - /* float ctime; */ /*UNUSED*/ /* frame & time changes */ float dfra, dtime; float birthtime, dietime; @@ -3412,7 +3419,6 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) dfra= cfra - psys->cfra; timestep = psys_get_timestep(sim); - /*ctime= cfra*timestep;*/ /*UNUSED*/ dtime= dfra*timestep; if(dfra<0.0){ @@ -3675,7 +3681,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) if( fluidmd && fluidmd->fss) { FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; - ParticleData *pa=0; + ParticleData *pa=NULL; const char *suffix = "fluidsurface_particles_####"; const char *suffix2 = ".gz"; char filename[256]; |