Go back to using free/malloc rather than realloc as may be slower
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12999 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
cc5b232021
commit
1fbcafc0ea
1 changed files with 4 additions and 4 deletions
|
|
@ -394,11 +394,11 @@ namespace std {
|
|||
}
|
||||
#else
|
||||
%typemap(memberin) char * {
|
||||
free($1);
|
||||
if ($input) {
|
||||
$1 = ($1_type) realloc($1, strlen((const char *)$input)+1);
|
||||
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
|
||||
strcpy((char *)$1, (const char *)$input);
|
||||
} else {
|
||||
free($1);
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -411,11 +411,11 @@ namespace std {
|
|||
}
|
||||
}
|
||||
%typemap(globalin) char * {
|
||||
free($1);
|
||||
if ($input) {
|
||||
$1 = ($1_type) realloc($1, strlen((const char *)$input)+1);
|
||||
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
|
||||
strcpy((char *)$1, (const char *)$input);
|
||||
} else {
|
||||
free ($1);
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue