summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-27 05:43:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-27 05:43:59 +0000
commit043c693d6a7521604ced80a0619d38b4f187f1c9 (patch)
tree08a62debbd5753df259ebbaab6efb7e620dfae12
parente6480a1f2ac7aca4d49749c6ec980cf30ce79794 (diff)
tcltklib#invoke(2)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/tcltklib/tcltklib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 5f90d25..b63b1d0 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -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;