[Rcpp-commits] r3510 - in pkg/RcppSMC: . inst/include src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 15 22:03:58 CET 2012


Author: edd
Date: 2012-03-15 22:03:58 +0100 (Thu, 15 Mar 2012)
New Revision: 3510

Modified:
   pkg/RcppSMC/ChangeLog
   pkg/RcppSMC/inst/include/pffuncs.h
   pkg/RcppSMC/src/pf.cpp
Log:
fix one include .hh
fix one more new/delete
minor changelog edit


Modified: pkg/RcppSMC/ChangeLog
===================================================================
--- pkg/RcppSMC/ChangeLog	2012-03-15 20:05:30 UTC (rev 3509)
+++ pkg/RcppSMC/ChangeLog	2012-03-15 21:03:58 UTC (rev 3510)
@@ -1,3 +1,7 @@
+2012-03-15  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/pf.cpp: Another new/delete cleanup
+
 2012-03-15  Adam Johansen <a.m.johansen at warwick.ac.uk>
 
 	* Standardized file extensions .h and .cpp
@@ -5,10 +9,12 @@
 	src/blockpfgaussianopt.cpp.
 	* src/pffuncs.cpp merged into src/pf.cpp.
 
+2012-03-13  Dirk Eddelbuettel  <edd at debian.org>
+	
+	* src/blockpfgaussianoptfuncs.cc: minor new/delete fix
+	
 2012-03-13  Adam Johansen <a.m.johansen at warwick.ac.uk>
 
-	* DESCRIPTION: Version 0.0.3
-
 	* NAMESPACE: Added blockpfGaussianOpt.
 	* inst/include/blockpfguassianopt.hh: Declarations for univariate
 	block-sampling particle filter implementation.

Modified: pkg/RcppSMC/inst/include/pffuncs.h
===================================================================
--- pkg/RcppSMC/inst/include/pffuncs.h	2012-03-15 20:05:30 UTC (rev 3509)
+++ pkg/RcppSMC/inst/include/pffuncs.h	2012-03-15 21:03:58 UTC (rev 3510)
@@ -1,4 +1,4 @@
-#include "smctc.hh"
+#include "smctc.h"
 
 class cv_state
 {

Modified: pkg/RcppSMC/src/pf.cpp
===================================================================
--- pkg/RcppSMC/src/pf.cpp	2012-03-15 20:05:30 UTC (rev 3509)
+++ pkg/RcppSMC/src/pf.cpp	2012-03-15 21:03:58 UTC (rev 3510)
@@ -96,7 +96,7 @@
   FILE * fObs = fopen(szName,"rt");
   if (!fObs)
     throw SMC_EXCEPTION(SMCX_FILE_NOT_FOUND, "Error: pf assumes that the current directory contains an appropriate data file called data.csv\nThe first line should contain a constant indicating the number of data lines it contains.\nThe remaining lines should contain comma-separated pairs of x,y observations.");
-  char* szBuffer = new char[1024];
+  char szBuffer[1024];
   char* rc = fgets(szBuffer, 1024, fObs);
   if (rc==NULL)
     throw SMC_EXCEPTION(SMCX_FILE_NOT_FOUND, "Error: no data found.");
@@ -108,12 +108,10 @@
     {
       rc = fgets(szBuffer, 1024, fObs);
       (*yp)[i].x_pos = strtod(strtok(szBuffer, ",\r\n "), NULL);
-      (*yp)[i].y_pos = strtod(strtok(NULL, ",\r\n "), NULL);
+      (*yp)[i].y_pos = strtod(strtok(szBuffer, ",\r\n "), NULL);
     }
   fclose(fObs);
 
-  delete [] szBuffer;
-
   return lIterates;
 }
 



More information about the Rcpp-commits mailing list