merge from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12011 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
75d2abfddb
21 changed files with 466 additions and 76 deletions
|
|
@ -122,7 +122,7 @@ SWIGINTERN int
|
|||
SWIG_AsCharPtrAndSize(SEXP obj, char** cptr, size_t* psize, int *alloc)
|
||||
{
|
||||
if (cptr && Rf_isString(obj)) {
|
||||
const char *cstr = CHAR(STRING_ELT(obj, 0));
|
||||
char *cstr = %const_cast(CHAR(STRING_ELT(obj, 0)), char *);
|
||||
int len = strlen(cstr);
|
||||
|
||||
if (alloc) {
|
||||
|
|
@ -130,9 +130,7 @@ SWIG_AsCharPtrAndSize(SEXP obj, char** cptr, size_t* psize, int *alloc)
|
|||
*cptr = %new_copy_array(cstr, len + 1, char);
|
||||
*alloc = SWIG_NEWOBJ;
|
||||
} else {
|
||||
*cptr = %reinterpret_cast(malloc(len + 1), char *);
|
||||
*cptr = strcpy(*cptr, cstr);
|
||||
*alloc = SWIG_OLDOBJ;
|
||||
*cptr = cstr;
|
||||
}
|
||||
} else {
|
||||
*cptr = %reinterpret_cast(malloc(len + 1), char *);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue