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

* thread.c (rb_thread_key_p): thread local storage stores ID.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-05-07 21:27:34 +00:00
parent 60219a0aa3
commit 86afcfe402
3 changed files with 8 additions and 5 deletions

View file

@ -1,3 +1,7 @@
Thu May 8 06:27:33 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (rb_thread_key_p): thread local storage stores ID.
Thu May 8 01:10:03 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Thu May 8 01:10:03 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (tr_trans): should squeeze properly. [ruby-dev:34587] * string.c (tr_trans): should squeeze properly. [ruby-dev:34587]

View file

@ -4368,7 +4368,6 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
int clen, tlen, max = RSTRING_LEN(str) * 1.2; int clen, tlen, max = RSTRING_LEN(str) * 1.2;
int offset; int offset;
char *buf = ALLOC_N(char, max), *t = buf; char *buf = ALLOC_N(char, max), *t = buf;
VALUE v;
while (s < send) { while (s < send) {
c0 = c = rb_enc_codepoint(s, send, enc); c0 = c = rb_enc_codepoint(s, send, enc);

View file

@ -70,9 +70,9 @@ static VALUE eTerminateSignal = INT2FIX(1);
static volatile int system_working = 1; static volatile int system_working = 1;
inline static void inline static void
st_delete_wrap(st_table * table, VALUE key) st_delete_wrap(st_table *table, st_data_t key)
{ {
st_delete(table, (st_data_t *) & key, 0); st_delete(table, &key, 0);
} }
/********************************************************************************/ /********************************************************************************/
@ -1522,7 +1522,7 @@ rb_thread_local_aset(VALUE thread, ID id, VALUE val)
th->local_storage = st_init_numtable(); th->local_storage = st_init_numtable();
} }
if (NIL_P(val)) { if (NIL_P(val)) {
st_delete(th->local_storage, (st_data_t *) & id, 0); st_delete_wrap(th->local_storage, id);
return Qnil; return Qnil;
} }
st_insert(th->local_storage, id, val); st_insert(th->local_storage, id, val);
@ -1567,7 +1567,7 @@ rb_thread_key_p(VALUE self, VALUE key)
if (!th->local_storage) { if (!th->local_storage) {
return Qfalse; return Qfalse;
} }
if (st_lookup(th->local_storage, key, 0)) { if (st_lookup(th->local_storage, id, 0)) {
return Qtrue; return Qtrue;
} }
return Qfalse; return Qfalse;