1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/tkutil.c: remove the some codes which depend on the

defference between Ruby1.8 and 1.9, because st.c on Ruby1.9 was
  changed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2005-03-06 16:24:43 +00:00
parent 3c5da1721b
commit 1c536c2a98
2 changed files with 7 additions and 57 deletions

View file

@ -1,3 +1,9 @@
Mon Mar 7 01:22:14 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tkutil.c: remove the some codes which depend on the
defference between Ruby1.8 and 1.9, because st.c on Ruby1.9
was changed.
Mon Mar 7 00:01:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Mon Mar 7 00:01:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: fail to call TclTkLib.mainloop when $SAFE==4 * ext/tcltklib/tcltklib.c: fail to call TclTkLib.mainloop when $SAFE==4

View file

@ -8,20 +8,12 @@
************************************************/ ************************************************/
#define TKUTIL_RELEASE_DATE "2005-03-02" #define TKUTIL_RELEASE_DATE "2005-03-07"
#include "ruby.h" #include "ruby.h"
#include "rubysig.h" #include "rubysig.h"
#include "st.h" #include "st.h"
/* check ruby_version */
#include "version.h"
#if RUBY_VERSION_MINOR == 9
#define ST_FOREACH_PASS_ERR_ARG 1 /* Ruby 1.9 */
#else
#define ST_FOREACH_PASS_ERR_ARG 0 /* Ruby 1.8 (from 2005/02/08) */
#endif
static VALUE cMethod; static VALUE cMethod;
static VALUE cTclTkLib; static VALUE cTclTkLib;
@ -207,36 +199,12 @@ fromUTF8_toDefaultEnc(str, self)
return tk_fromUTF8(1, argv, self); return tk_fromUTF8(1, argv, self);
} }
#if ST_FOREACH_PASS_ERR_ARG
static void
hash_check(err)
int err;
{
if (err) {
rb_raise(rb_eRuntimeError, "hash modified during iteration");
}
}
#endif
#if ST_FOREACH_PASS_ERR_ARG
static int
to_strkey(key, value, hash, err)
VALUE key;
VALUE value;
VALUE hash;
int err;
#else
static int static int
to_strkey(key, value, hash) to_strkey(key, value, hash)
VALUE key; VALUE key;
VALUE value; VALUE value;
VALUE hash; VALUE hash;
#endif
{ {
#if ST_FOREACH_PASS_ERR_ARG
hash_check(err);
#endif
if (key == Qundef) return ST_CONTINUE; if (key == Qundef) return ST_CONTINUE;
rb_hash_aset(hash, rb_funcall(key, ID_to_s, 0, 0), value); rb_hash_aset(hash, rb_funcall(key, ID_to_s, 0, 0), value);
return ST_CHECK; return ST_CHECK;
@ -484,26 +452,14 @@ assoc2kv_enc(assoc, ary, self)
} }
} }
#if ST_FOREACH_PASS_ERR_ARG
static int
push_kv(key, val, args, err)
VALUE key;
VALUE val;
VALUE args;
int err;
#else
static int static int
push_kv(key, val, args) push_kv(key, val, args)
VALUE key; VALUE key;
VALUE val; VALUE val;
VALUE args; VALUE args;
#endif
{ {
volatile VALUE ary; volatile VALUE ary;
#if ST_FOREACH_PASS_ERR_ARG
hash_check(err);
#endif
ary = RARRAY(args)->ptr[0]; ary = RARRAY(args)->ptr[0];
if (key == Qundef) return ST_CONTINUE; if (key == Qundef) return ST_CONTINUE;
@ -544,26 +500,14 @@ hash2kv(hash, ary, self)
} }
} }
#if ST_FOREACH_PASS_ERR_ARG
static int
push_kv_enc(key, val, args, err)
VALUE key;
VALUE val;
VALUE args;
int err;
#else
static int static int
push_kv_enc(key, val, args) push_kv_enc(key, val, args)
VALUE key; VALUE key;
VALUE val; VALUE val;
VALUE args; VALUE args;
#endif
{ {
volatile VALUE ary; volatile VALUE ary;
#if ST_FOREACH_PASS_ERR_ARG
hash_check(err);
#endif
ary = RARRAY(args)->ptr[0]; ary = RARRAY(args)->ptr[0];
if (key == Qundef) return ST_CONTINUE; if (key == Qundef) return ST_CONTINUE;