Fix problem that was causing breakage in pre-2.7 R

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10471 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Joseph Wang 2008-05-20 02:26:01 +00:00
commit 43a6695de0
2 changed files with 3 additions and 14 deletions

View file

@ -164,14 +164,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SEXP t, c;
if (!carray) return R_NilValue;
RVERSION27(return Rf_mkCharLen(carray, size));
RVERSIONPRE27(
Rf_protect(t = Rf_allocVector(STRSXP, 1));
c = allocString(size);
c = Rf_allocVector(CHARSXP, size);
strncpy((char *)CHAR(c), carray, size);
SET_STRING_ELT(t, 0, c);
Rf_unprotect(1);
return t;)
return t;
}
}

View file

@ -18,18 +18,10 @@ extern "C" {
#define SWIGR 1
#if R_VERSION >= R_Version(2,7,0)
#if R_VERSION >= R_Version(2,6,0)
#define VMAXTYPE void *
#define RVERSION27(x) x
#define RVERSIONPRE27(x)
#elif R_VERSION >= R_Version(2,6,0)
#define VMAXTYPE void *
#define RVERSION26(x) x
#define RVERSIONPRE26(x)
#else
#define VMAXTYPE char *
#define RVERSION26(x)
#define RVERSIONPRE26(x) x
#endif
/*