Add "freearg" template

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10037 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Joseph Wang 2007-10-25 11:30:11 +00:00
commit 54f0b11ddf
2 changed files with 47 additions and 10 deletions

View file

@ -96,24 +96,38 @@ SWIG_InitializeModule(0);
}
%typemap(in,noblock=1) char* {
$1 = %reinterpret_cast(%const_cast(CHAR(STRING_ELT($input, 0)),
char *), $1_ltype);
$1 = %reinterpret_cast(strdup(CHAR(STRING_ELT($input, 0))), $1_ltype);
}
%typemap(freearg,noblock=1) char* {
free($1);
}
%typemap(in,noblock=1) char *[ANY] {
$1 = %reinterpret_cast(%const_cast(CHAR(STRING_ELT($input, 0)),
char *),
$1_ltype);
$1 = %reinterpret_cast(strdup(CHAR(STRING_ELT($input, 0))), $1_ltype);
}
%typemap(freearg,noblock=1) char *[ANY] {
free($1);
}
%typemap(in,noblock=1) char[ANY] {
$1 = %const_cast(CHAR(STRING_ELT($input, 0)), char *);
$1 = strdup(CHAR(STRING_ELT($input, 0)));
}
%typemap(freearg,noblock=1) char[ANY] {
free($1);
}
%typemap(in,noblock=1) char[] {
$1 = %const_cast(CHAR(STRING_ELT($input, 0)), char *);
$1 = strdup(CHAR(STRING_ELT($input, 0)));
}
%typemap(freearg,noblock=1) char[] {
free($1);
}
%typemap(memberin) char[] %{
if ($input) strcpy($1, $input);
else