Apply patch #3511009 from Leif Middelschulte for slightly optimised char * variable wrappers.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12979 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5c8e5542ef
commit
478496bcae
2 changed files with 9 additions and 6 deletions
|
|
@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 2.0.5 (in progress)
|
Version 2.0.5 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2012-04-13: wsfulton
|
||||||
|
Apply patch #3511009 from Leif Middelschulte for slightly optimised char * variable wrappers.
|
||||||
|
|
||||||
2012-04-13: wsfulton
|
2012-04-13: wsfulton
|
||||||
[Lua] Apply #3219676 from Shane Liesegang which adds:
|
[Lua] Apply #3219676 from Shane Liesegang which adds:
|
||||||
- support for %factory
|
- support for %factory
|
||||||
|
|
|
||||||
12
Lib/swig.swg
12
Lib/swig.swg
|
|
@ -359,7 +359,7 @@ namespace std {
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
%typemap(memberin) char * {
|
%typemap(memberin) char * {
|
||||||
if ($1) delete [] $1;
|
delete [] $1;
|
||||||
if ($input) {
|
if ($input) {
|
||||||
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
|
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
|
||||||
strcpy((char *)$1, (const char *)$input);
|
strcpy((char *)$1, (const char *)$input);
|
||||||
|
|
@ -376,7 +376,7 @@ namespace std {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%typemap(globalin) char * {
|
%typemap(globalin) char * {
|
||||||
if ($1) delete [] $1;
|
delete [] $1;
|
||||||
if ($input) {
|
if ($input) {
|
||||||
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
|
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
|
||||||
strcpy((char *)$1, (const char *)$input);
|
strcpy((char *)$1, (const char *)$input);
|
||||||
|
|
@ -394,11 +394,11 @@ namespace std {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
%typemap(memberin) char * {
|
%typemap(memberin) char * {
|
||||||
if ($1) free((char *)$1);
|
|
||||||
if ($input) {
|
if ($input) {
|
||||||
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
|
$1 = ($1_type) realloc($1, strlen((const char *)$input)+1);
|
||||||
strcpy((char *)$1, (const char *)$input);
|
strcpy((char *)$1, (const char *)$input);
|
||||||
} else {
|
} else {
|
||||||
|
free($1);
|
||||||
$1 = 0;
|
$1 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -411,11 +411,11 @@ namespace std {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%typemap(globalin) char * {
|
%typemap(globalin) char * {
|
||||||
if ($1) free((char *)$1);
|
|
||||||
if ($input) {
|
if ($input) {
|
||||||
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
|
$1 = ($1_type) realloc($1, strlen((const char *)$input)+1);
|
||||||
strcpy((char *)$1, (const char *)$input);
|
strcpy((char *)$1, (const char *)$input);
|
||||||
} else {
|
} else {
|
||||||
|
free ($1);
|
||||||
$1 = 0;
|
$1 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue