mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge changes between r11871 and r11907 from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@11908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b7111d382c
commit
9369118f8f
11 changed files with 85 additions and 60 deletions
39
ChangeLog
39
ChangeLog
|
|
@ -1,3 +1,42 @@
|
|||
Tue Feb 27 20:49:19 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* lib/base64.rb (Base64::b64encode): Fix documentation; submitted
|
||||
by David Symonds <dsymonds@gmail.com> in [ruby-core:10432].
|
||||
|
||||
* regex.c (calculate_must_string, slow_search, re_search): Silence
|
||||
warnings regarding char * vs. unsigned char * mismatch;
|
||||
submitted by Lyle Johnson <lyle.johnson@gmail.com>
|
||||
in [ruby-core:10416].
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_load): Ditto.
|
||||
|
||||
* ext/digest/sha1/sha1ossl.c (SHA1_Finish): Ditto.
|
||||
|
||||
* ext/digest/rmd160/rmd160ossl.c (RMD160_Finish): Ditto.
|
||||
|
||||
* ext/digest/digest.c (rb_digest_base_finish,
|
||||
rb_digest_base_update): Ditto.
|
||||
|
||||
* ext/nkf/nkf.c (rb_str_resize, rb_nkf_kconv, rb_nkf_guess1,
|
||||
rb_nkf_guess2): Ditto.
|
||||
|
||||
* ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock):
|
||||
Eliminate rb_thread_critical switching where unnecessary;
|
||||
implied by shugo in [ruby-dev:30412].
|
||||
|
||||
* ext/thread/thread.c (set_critical): Merge in
|
||||
thread_exclusive_ensure().
|
||||
|
||||
* ext/thread/thread.c: Consistently use 0 and 1 for
|
||||
rb_thread_critical values.
|
||||
|
||||
* ext/thread/thread.c: Use xmalloc()/xfree() instead of
|
||||
malloc()/free(); pointed out by shugo in [ruby-dev:30412].
|
||||
|
||||
* lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::initialize):
|
||||
Initialize @workdir properly to silence a warning under -w.
|
||||
Submitted by <tommy at tmtm.org> in [ruby-dev:30400].
|
||||
|
||||
Sun Feb 25 02:50:51 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* defines.h: Pull the RUBY_MBCHAR_MAXSIZE definition from trunk,
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ BigDecimal_load(VALUE self, VALUE str)
|
|||
unsigned long m=0;
|
||||
|
||||
SafeStringValue(str);
|
||||
pch = RSTRING_PTR(str);
|
||||
pch = (unsigned char *)RSTRING_PTR(str);
|
||||
/* First get max prec */
|
||||
while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
|
||||
if(!ISDIGIT(ch)) {
|
||||
|
|
@ -341,7 +341,7 @@ BigDecimal_load(VALUE self, VALUE str)
|
|||
m = m*10 + (unsigned long)(ch-'0');
|
||||
}
|
||||
if(m>VpBaseFig()) m -= VpBaseFig();
|
||||
GUARD_OBJ(pv,VpNewRbClass(m,pch,self));
|
||||
GUARD_OBJ(pv,VpNewRbClass(m,(char *)pch,self));
|
||||
m /= VpBaseFig();
|
||||
if(m && pv->MaxPrec>m) pv->MaxPrec = m+1;
|
||||
return ToValue(pv);
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ rb_digest_base_update(VALUE self, VALUE str)
|
|||
Data_Get_Struct(self, void, pctx);
|
||||
|
||||
StringValue(str);
|
||||
algo->update_func(pctx, RSTRING_PTR(str), RSTRING_LEN(str));
|
||||
algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
@ -537,7 +537,7 @@ rb_digest_base_finish(VALUE self)
|
|||
Data_Get_Struct(self, void, pctx);
|
||||
|
||||
str = rb_str_new(0, algo->digest_len);
|
||||
algo->finish_func(pctx, RSTRING_PTR(str));
|
||||
algo->finish_func(pctx, (unsigned char *)RSTRING_PTR(str));
|
||||
|
||||
/* avoid potential coredump caused by use of a finished context */
|
||||
algo->init_func(pctx);
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@
|
|||
#include "rmd160ossl.h"
|
||||
|
||||
void RMD160_Finish(RMD160_CTX *ctx, char *buf) {
|
||||
RIPEMD160_Final(buf, ctx);
|
||||
RIPEMD160_Final((unsigned char *)buf, ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@
|
|||
void
|
||||
SHA1_Finish(SHA1_CTX *ctx, char *buf)
|
||||
{
|
||||
SHA1_Final(buf, ctx);
|
||||
SHA1_Final((unsigned char *)buf, ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ rb_nkf_putchar(c)
|
|||
o_len += incsize;
|
||||
rb_str_resize(result, o_len);
|
||||
incsize *= 2;
|
||||
output = RSTRING(result)->ptr;
|
||||
output = (unsigned char *)RSTRING(result)->ptr;
|
||||
}
|
||||
output[output_ctr++] = c;
|
||||
|
||||
|
|
@ -158,13 +158,13 @@ rb_nkf_kconv(obj, opt, src)
|
|||
|
||||
input_ctr = 0;
|
||||
StringValue(src);
|
||||
input = RSTRING(src)->ptr;
|
||||
input = (unsigned char *)RSTRING(src)->ptr;
|
||||
i_len = RSTRING(src)->len;
|
||||
result = rb_str_new(0, i_len*3 + 10);
|
||||
v = result;
|
||||
|
||||
output_ctr = 0;
|
||||
output = RSTRING(result)->ptr;
|
||||
output = (unsigned char *)RSTRING(result)->ptr;
|
||||
o_len = RSTRING(result)->len;
|
||||
*output = '\0';
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ rb_nkf_guess1(obj, src)
|
|||
int sequence_counter = 0;
|
||||
|
||||
StringValue(src);
|
||||
p = RSTRING(src)->ptr;
|
||||
p = (unsigned char *)RSTRING(src)->ptr;
|
||||
pend = p + RSTRING(src)->len;
|
||||
if (p == pend) return INT2FIX(_UNKNOWN);
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ rb_nkf_guess2(obj, src)
|
|||
|
||||
input_ctr = 0;
|
||||
StringValue(src);
|
||||
input = RSTRING(src)->ptr;
|
||||
input = (unsigned char *)RSTRING(src)->ptr;
|
||||
i_len = RSTRING(src)->len;
|
||||
|
||||
if(x0201_f == WISH_TRUE)
|
||||
|
|
|
|||
|
|
@ -18,23 +18,16 @@ static VALUE rb_cConditionVariable;
|
|||
static VALUE rb_cQueue;
|
||||
static VALUE rb_cSizedQueue;
|
||||
|
||||
static VALUE set_critical(VALUE value);
|
||||
|
||||
static VALUE
|
||||
thread_exclusive_do()
|
||||
thread_exclusive_do(void)
|
||||
{
|
||||
rb_thread_critical = Qtrue;
|
||||
rb_thread_critical = 1;
|
||||
|
||||
return rb_yield(Qundef);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
thread_exclusive_ensure(val)
|
||||
VALUE val;
|
||||
{
|
||||
rb_thread_critical = val;
|
||||
|
||||
return Qundef;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* Thread.exclusive { block } => obj
|
||||
|
|
@ -45,9 +38,9 @@ thread_exclusive_ensure(val)
|
|||
*/
|
||||
|
||||
static VALUE
|
||||
rb_thread_exclusive()
|
||||
rb_thread_exclusive(void)
|
||||
{
|
||||
return rb_ensure(thread_exclusive_do, Qundef, thread_exclusive_ensure, rb_thread_critical);
|
||||
return rb_ensure(thread_exclusive_do, Qundef, set_critical, rb_thread_critical);
|
||||
}
|
||||
|
||||
typedef struct _Entry {
|
||||
|
|
@ -86,7 +79,7 @@ free_entries(Entry *first)
|
|||
Entry *next;
|
||||
while (first) {
|
||||
next = first->next;
|
||||
free(first);
|
||||
xfree(first);
|
||||
first = next;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +100,7 @@ push_list(List *list, VALUE value)
|
|||
entry = list->entry_pool;
|
||||
list->entry_pool = entry->next;
|
||||
} else {
|
||||
entry = (Entry *)malloc(sizeof(Entry));
|
||||
entry = (Entry *)xmalloc(sizeof(Entry));
|
||||
}
|
||||
|
||||
entry->value = value;
|
||||
|
|
@ -254,9 +247,7 @@ static VALUE
|
|||
wait_list_cleanup(List *list)
|
||||
{
|
||||
/* cleanup in case of spurious wakeups */
|
||||
rb_thread_critical = 1;
|
||||
remove_one(list, rb_thread_current());
|
||||
rb_thread_critical = 0;
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +316,7 @@ free_mutex(Mutex *mutex)
|
|||
{
|
||||
assert_no_survivors(&mutex->waiting, "mutex", mutex);
|
||||
finalize_mutex(mutex);
|
||||
free(mutex);
|
||||
xfree(mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -347,7 +338,7 @@ static VALUE
|
|||
rb_mutex_alloc(VALUE klass)
|
||||
{
|
||||
Mutex *mutex;
|
||||
mutex = (Mutex *)malloc(sizeof(Mutex));
|
||||
mutex = (Mutex *)xmalloc(sizeof(Mutex));
|
||||
init_mutex(mutex);
|
||||
return Data_Wrap_Struct(klass, mark_mutex, free_mutex, mutex);
|
||||
}
|
||||
|
|
@ -381,20 +372,14 @@ static VALUE
|
|||
rb_mutex_try_lock(VALUE self)
|
||||
{
|
||||
Mutex *mutex;
|
||||
VALUE result;
|
||||
|
||||
Data_Get_Struct(self, Mutex, mutex);
|
||||
|
||||
result = Qfalse;
|
||||
if (RTEST(mutex->owner))
|
||||
return Qfalse;
|
||||
|
||||
rb_thread_critical = 1;
|
||||
if (!RTEST(mutex->owner)) {
|
||||
mutex->owner = rb_thread_current();
|
||||
result = Qtrue;
|
||||
}
|
||||
rb_thread_critical = 0;
|
||||
|
||||
return result;
|
||||
return Qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -456,7 +441,7 @@ static VALUE
|
|||
set_critical(VALUE value)
|
||||
{
|
||||
rb_thread_critical = (int)value;
|
||||
return Qnil;
|
||||
return Qundef;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
@ -598,7 +583,7 @@ free_condvar(ConditionVariable *condvar)
|
|||
{
|
||||
assert_no_survivors(&condvar->waiting, "condition variable", condvar);
|
||||
finalize_condvar(condvar);
|
||||
free(condvar);
|
||||
xfree(condvar);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -620,7 +605,7 @@ rb_condvar_alloc(VALUE klass)
|
|||
{
|
||||
ConditionVariable *condvar;
|
||||
|
||||
condvar = (ConditionVariable *)malloc(sizeof(ConditionVariable));
|
||||
condvar = (ConditionVariable *)xmalloc(sizeof(ConditionVariable));
|
||||
init_condvar(condvar);
|
||||
|
||||
return Data_Wrap_Struct(klass, mark_condvar, free_condvar, condvar);
|
||||
|
|
@ -639,11 +624,11 @@ wait_condvar(ConditionVariable *condvar, Mutex *mutex)
|
|||
{
|
||||
rb_thread_critical = 1;
|
||||
if (!RTEST(mutex->owner)) {
|
||||
rb_thread_critical = Qfalse;
|
||||
rb_thread_critical = 0;
|
||||
return;
|
||||
}
|
||||
if (mutex->owner != rb_thread_current()) {
|
||||
rb_thread_critical = Qfalse;
|
||||
rb_thread_critical = 0;
|
||||
rb_raise(rb_eThreadError, "Not owner");
|
||||
}
|
||||
mutex->owner = Qnil;
|
||||
|
|
@ -806,7 +791,7 @@ free_queue(Queue *queue)
|
|||
assert_no_survivors(&queue->space_available.waiting, "queue", queue);
|
||||
assert_no_survivors(&queue->value_available.waiting, "queue", queue);
|
||||
finalize_queue(queue);
|
||||
free(queue);
|
||||
xfree(queue);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -831,7 +816,7 @@ static VALUE
|
|||
rb_queue_alloc(VALUE klass)
|
||||
{
|
||||
Queue *queue;
|
||||
queue = (Queue *)malloc(sizeof(Queue));
|
||||
queue = (Queue *)xmalloc(sizeof(Queue));
|
||||
init_queue(queue);
|
||||
return Data_Wrap_Struct(klass, mark_queue, free_queue, queue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ module Base64
|
|||
#
|
||||
# require 'base64'
|
||||
# data = "Now is the time for all good coders\nto learn Ruby"
|
||||
# puts Base64.b64encode(data)
|
||||
# Base64.b64encode(data)
|
||||
#
|
||||
# <i>Generates:</i>
|
||||
#
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ module Test
|
|||
@filters = []
|
||||
@to_run = []
|
||||
@output_level = UI::NORMAL
|
||||
@workdir = nil
|
||||
yield(self) if(block_given?)
|
||||
end
|
||||
|
||||
|
|
|
|||
18
regex.c
18
regex.c
|
|
@ -1014,8 +1014,8 @@ calculate_must_string(start, end)
|
|||
{
|
||||
int mcnt;
|
||||
int max = 0;
|
||||
unsigned char *p = start;
|
||||
unsigned char *pend = end;
|
||||
unsigned char *p = (unsigned char *)start;
|
||||
unsigned char *pend = (unsigned char *)end;
|
||||
char *must = 0;
|
||||
|
||||
if (start == NULL) return 0;
|
||||
|
|
@ -1029,7 +1029,7 @@ calculate_must_string(start, end)
|
|||
case exactn:
|
||||
mcnt = *p;
|
||||
if (mcnt > max) {
|
||||
must = p;
|
||||
must = (char *)p;
|
||||
max = mcnt;
|
||||
}
|
||||
p += mcnt+1;
|
||||
|
|
@ -2689,7 +2689,7 @@ slow_search(little, llen, big, blen, translate)
|
|||
}
|
||||
}
|
||||
|
||||
if (slow_match(little, little+llen, big, bend, translate))
|
||||
if (slow_match(little, little+llen, big, bend, (unsigned char *)translate))
|
||||
return big - bsave;
|
||||
|
||||
big+=mbclen(*big);
|
||||
|
|
@ -3222,13 +3222,13 @@ re_search(bufp, string, size, startpos, range, regs)
|
|||
}
|
||||
pend = size;
|
||||
if (bufp->options & RE_OPTIMIZE_NO_BM) {
|
||||
pos = slow_search(bufp->must+1, len,
|
||||
string+pbeg, pend-pbeg,
|
||||
MAY_TRANSLATE()?translate:0);
|
||||
pos = slow_search((unsigned char *)(bufp->must+1), len,
|
||||
(unsigned char*)(string+pbeg), pend-pbeg,
|
||||
(char *)(MAY_TRANSLATE()?translate:0));
|
||||
}
|
||||
else {
|
||||
pos = bm_search(bufp->must+1, len,
|
||||
string+pbeg, pend-pbeg,
|
||||
pos = bm_search((unsigned char *)(bufp->must+1), len,
|
||||
(unsigned char *)(string+pbeg), pend-pbeg,
|
||||
bufp->must_skip,
|
||||
MAY_TRANSLATE()?translate:0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.8.6"
|
||||
#define RUBY_RELEASE_DATE "2007-02-25"
|
||||
#define RUBY_RELEASE_DATE "2007-02-27"
|
||||
#define RUBY_VERSION_CODE 186
|
||||
#define RUBY_RELEASE_CODE 20070225
|
||||
#define RUBY_RELEASE_CODE 20070227
|
||||
#define RUBY_PATCHLEVEL 0
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 6
|
||||
#define RUBY_RELEASE_YEAR 2007
|
||||
#define RUBY_RELEASE_MONTH 2
|
||||
#define RUBY_RELEASE_DAY 25
|
||||
#define RUBY_RELEASE_DAY 27
|
||||
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
RUBY_EXTERN const char ruby_release_date[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue