mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
tcltklib#invoke(2)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e6480a1f2a
commit
043c693d6a
1 changed files with 8 additions and 6 deletions
|
|
@ -184,6 +184,7 @@ ip_new(VALUE self)
|
|||
static VALUE
|
||||
ip_eval(VALUE self, VALUE str)
|
||||
{
|
||||
char *s;
|
||||
char *buf; /* Tcl_Eval requires re-writable string region */
|
||||
struct tcltkip *ptr; /* tcltkip data struct */
|
||||
|
||||
|
|
@ -191,9 +192,9 @@ ip_eval(VALUE self, VALUE str)
|
|||
Data_Get_Struct(self, struct tcltkip, ptr);
|
||||
|
||||
/* call Tcl_Eval() */
|
||||
Check_Type(str, T_STRING);
|
||||
buf = ALLOCA_N(char,RSTRING(str)->len+1);
|
||||
strcpy(buf, RSTRING(str)->ptr);
|
||||
s = STR2CSTR(str);
|
||||
buf = ALLOCA_N(char, strlen(s)+1);
|
||||
strcpy(buf, s);
|
||||
DUMP2("Tcl_Eval(%s)", buf);
|
||||
ptr->return_value = Tcl_Eval(ptr->ip, buf);
|
||||
if (ptr->return_value == TCL_ERROR) {
|
||||
|
|
@ -218,9 +219,10 @@ ip_invoke(int argc, VALUE *argv, VALUE obj)
|
|||
|
||||
av = (char **)ALLOCA_N(char **, argc+1);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
Check_Type(argv[i], T_STRING);
|
||||
av[i] = ALLOCA_N(char, RSTRING(argv[i])->len+1);
|
||||
strcpy(av[i], RSTRING(argv[i])->ptr);
|
||||
char *s = CTR2CSTR(argv[i]);
|
||||
|
||||
av[i] = ALLOCA_N(char, strlen(s)+1);
|
||||
strcpy(av[i], s);
|
||||
}
|
||||
av[argc] = NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue