Ruby: Replace all occurences of STR2CSTR macro with calls to StringValuePtr
STR2CSTR was deprecated in Ruby since years and got finally removed in Ruby 1.9 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13967 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5a2f1139c3
commit
23771ef027
8 changed files with 15 additions and 15 deletions
|
|
@ -14,7 +14,7 @@
|
|||
val = rb_hash_aref($input, key);
|
||||
Check_Type(key, T_STRING);
|
||||
Check_Type(val, T_FIXNUM);
|
||||
$2[i] = STR2CSTR(key);
|
||||
$2[i] = StringValuePtr(key);
|
||||
$3[i] = NUM2INT(val);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ extern int gcd(int x, int y);
|
|||
free($2);
|
||||
SWIG_exception(SWIG_ValueError, "List items must be strings");
|
||||
}
|
||||
$2[i] = STR2CSTR(s);
|
||||
$2[i] = StringValuePtr(s);
|
||||
}
|
||||
$2[i] = 0;
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ extern int gcdmain(int argc, char *argv[]);
|
|||
if (TYPE($input) != T_STRING) {
|
||||
SWIG_exception(SWIG_ValueError, "Expected a string");
|
||||
}
|
||||
$1 = STR2CSTR($input);
|
||||
$1 = StringValuePtr($input);
|
||||
$2 = RSTRING_LEN($input);
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ extern int count(char *bytes, int len, char c);
|
|||
if (TYPE($input) != T_STRING) {
|
||||
SWIG_exception(SWIG_ValueError,"Expected a string");
|
||||
}
|
||||
temp = STR2CSTR($input);
|
||||
temp = StringValuePtr($input);
|
||||
$2 = RSTRING_LEN($input);
|
||||
$1 = (char *) malloc($2+1);
|
||||
memmove($1,temp,$2);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
#ifdef SWIGRUBY
|
||||
%typemap(in) String {
|
||||
Check_Type($input, T_STRING);
|
||||
$1 = String(STR2CSTR($input));
|
||||
$1 = String(StringValuePtr($input));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace test {
|
|||
#endif
|
||||
#ifdef SWIGRUBY
|
||||
%typemap(in) string_class * {
|
||||
$1 = new string_class(STR2CSTR($input));
|
||||
$1 = new string_class(StringValuePtr($input));
|
||||
}
|
||||
%typemap(freearg) string_class * {
|
||||
delete $1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue