From 8fa9a916395652cab6c4fcebb17be677fd6091d1 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 27 Jan 2011 12:21:14 +0000 Subject: Fixing some clang reported issues in particle code. * Not really bugs, but some code cleanup and clarification. --- source/blender/blenkernel/intern/particle_system.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/particle_system.c') 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]; -- cgit v1.2.3