[rkward-cvs] SF.net SVN: rkward:[4082] trunk/rkward/rkward/rbackend/rkstructuregetter. cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Dec 8 08:43:28 UTC 2011


Revision: 4082
          http://rkward.svn.sourceforge.net/rkward/?rev=4082&view=rev
Author:   tfry
Date:     2011-12-08 08:43:27 +0000 (Thu, 08 Dec 2011)
Log Message:
-----------
Ouch. Rf_length(dummy) would decrease during the loop.

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rkstructuregetter.cpp

Modified: trunk/rkward/rkward/rbackend/rkstructuregetter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkstructuregetter.cpp	2011-12-07 18:46:53 UTC (rev 4081)
+++ trunk/rkward/rkward/rbackend/rkstructuregetter.cpp	2011-12-08 08:43:27 UTC (rev 4082)
@@ -439,7 +439,8 @@
 		// for the most part, the implicit as.character in SEXPToStringList does a good on the formals (and it's the fastest of many options that I have tried).
 		// Only for naked strings (as in 'function (a="something")'), we're missing the quotes. So we add quotes, after conversion, as needed:
 		SEXP dummy = formals_s;
-		for (int i = 0; i < Rf_length (dummy); ++i) {
+		const int formals_len = Rf_length (formals_s);
+		for (int i = 0; i < formals_len; ++i) {
 			if (TYPEOF (CAR (dummy)) == STRSXP) formals[i] = RKRSharedFunctionality::quote (formals[i]);
 			dummy = CDR (dummy);
 		}

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list