[Rinside-commits] r228 - in pkg: . src/setenv

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 9 03:10:23 CET 2012


Author: edd
Date: 2012-01-09 03:10:22 +0100 (Mon, 09 Jan 2012)
New Revision: 228

Modified:
   pkg/ChangeLog
   pkg/src/setenv/setenv.c
Log:
small cleanup related to not using cout/cerr or stderr to please R CMD check


Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2012-01-09 01:58:07 UTC (rev 227)
+++ pkg/ChangeLog	2012-01-09 02:10:22 UTC (rev 228)
@@ -7,6 +7,7 @@
 	R which blends both (millisecond) time and process id
 
 	* src/RInside.cpp: Replace fprintf(stderr,...) with Rf_error(...)
+	* src/setenv/setenv.c: Idem
 	
 	* inst/examples/*: Added CMake build support for all example
 	directories kindly provided by Peter Aberline; this helps when coding

Modified: pkg/src/setenv/setenv.c
===================================================================
--- pkg/src/setenv/setenv.c	2012-01-09 01:58:07 UTC (rev 227)
+++ pkg/src/setenv/setenv.c	2012-01-09 02:10:22 UTC (rev 228)
@@ -1,8 +1,9 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
 //
 // RInside.cpp: R/C++ interface class library -- Easier R embedding into C++
 //
 // Copyright (C) 2009 - 2010 Dirk Eddelbuettel and Richard Holbrey
+// Copyright (C) 2012        Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of RInside.
 //
@@ -32,16 +33,14 @@
     a = (char *) malloc((strlen(env_var) + 1) * sizeof(char));
     b = (char *) malloc((strlen(env_val) + 1) * sizeof(char));
     if (!a || !b) {
-	fprintf(stderr, "memory allocation failure in setenv");
-        exit(1);
+	Rf_error("memory allocation failure in setenv");
     }
     strcpy(a, env_var);
     strcpy(b, env_val);
 
     buf = (char *) malloc((strlen(a) + strlen(b) + 2) * sizeof(char));
-    if (!buf) {
-	fprintf(stderr, "memory allocation failure in setenv");
-        exit(1);
+    if (!buf) {	
+	Rf_error("memory allocation failure in setenv");
     }
     strcpy(buf, a); strcat(buf, "=");
     value = buf+strlen(buf);



More information about the Rinside-commits mailing list