[cig-commits] r6636 - mc/3D/ellipsis3d/trunk

walter at geodynamics.org walter at geodynamics.org
Mon Apr 23 12:51:40 PDT 2007


Author: walter
Date: 2007-04-23 12:51:39 -0700 (Mon, 23 Apr 2007)
New Revision: 6636

Modified:
   mc/3D/ellipsis3d/trunk/Tracer_initialization.c
Log:
Fix a bug where, during a realloc, old values were not being copied over correctly

Modified: mc/3D/ellipsis3d/trunk/Tracer_initialization.c
===================================================================
--- mc/3D/ellipsis3d/trunk/Tracer_initialization.c	2007-04-23 19:50:22 UTC (rev 6635)
+++ mc/3D/ellipsis3d/trunk/Tracer_initialization.c	2007-04-23 19:51:39 UTC (rev 6636)
@@ -195,10 +195,14 @@
 	  current_allocation,E->tracer.NUM_TRACERS); */
 
   if(E->tracer.NUM_TRACERS > current_allocation) {  /* Yes we do */
-    old_allocation = current_allocation;
+    /* This song and dance with +/-1 is because the code want indices
+       from 1 to N, but C like 0 to N-1 */
+    old_allocation = current_allocation+1;
     current_allocation += granularity;
-    former_highest_tracer = old_allocation;
+    former_highest_tracer = old_allocation-1;
     current_highest_tracer = current_allocation;
+    if(old_allocation==1)
+      old_allocation=0;
   }
   else {
     return;



More information about the cig-commits mailing list