[Pomp-commits] r345 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 29 17:36:58 CEST 2010


Author: kingaa
Date: 2010-09-29 17:36:58 +0200 (Wed, 29 Sep 2010)
New Revision: 345

Modified:
   pkg/src/euler.c
   pkg/src/rmeasure.c
Log:

- use R_alloc instead of Calloc/Free


Modified: pkg/src/euler.c
===================================================================
--- pkg/src/euler.c	2010-09-29 15:34:36 UTC (rev 344)
+++ pkg/src/euler.c	2010-09-29 15:36:58 UTC (rev 345)
@@ -297,7 +297,7 @@
     SET_TAG(FCALL,install("x"));
     PROTECT(FCALL = LCONS(fn,FCALL)); nprotect++;
     ff = (pomp_onestep_sim *) default_onestep_sim_fn;
-    VINDEX = (int *) Calloc(nvar,int);
+    VINDEX = (int *) R_alloc(nvar,sizeof(int));
     FIRST = 1;
   }
 
@@ -347,7 +347,6 @@
   
   if (use_native) PutRNGstate();
 
-  if (VINDEX != 0) Free(VINDEX);
   VINDEX = 0;
 
   UNPROTECT(nprotect);

Modified: pkg/src/rmeasure.c
===================================================================
--- pkg/src/rmeasure.c	2010-09-29 15:34:36 UTC (rev 344)
+++ pkg/src/rmeasure.c	2010-09-29 15:36:58 UTC (rev 345)
@@ -207,7 +207,7 @@
     PROTECT(FCALL = LCONS(XVEC,FCALL)); nprotect++;
     SET_TAG(FCALL,install("x"));
     PROTECT(FCALL = LCONS(fn,FCALL)); nprotect++;
-    OIDX = (int *) Calloc(nobs,int);
+    OIDX = (int *) R_alloc(nobs,sizeof(int));
     FIRST = 1;
     break;
   case 1:				// use native routine
@@ -262,7 +262,6 @@
 
   if (use_native) PutRNGstate();
 
-  if (OIDX != 0) Free(OIDX);
   OIDX = 0;
   FIRST = 0;
 



More information about the pomp-commits mailing list