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

* time.c (time_new_internal): avoid loop to calculate negative

div, mod.

* time.c (time_cmp): should handle Bignums.

* array.c (rb_ary_pop): should ELTS_SHARED flag check before
  REALLOC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-12-13 08:19:09 +00:00
parent a59c599209
commit d8c75ddad3
5 changed files with 51 additions and 22 deletions

View file

@ -159,13 +159,13 @@ rb_gdbm_fetch(dbm, key)
datum key;
{
datum val;
VALUE str = rb_obj_alloc(rb_cString);
VALUE str;
val = gdbm_fetch(dbm, key);
if (val.dptr == 0)
return Qnil;
RSTRING(str)->ptr = 0;
str = rb_obj_alloc(rb_cString);
RSTRING(str)->len = val.dsize;
RSTRING(str)->aux.capa = val.dsize;
RSTRING(str)->ptr = REALLOC_N(val.dptr,char,val.dsize+1);
@ -206,13 +206,13 @@ rb_gdbm_firstkey(dbm)
GDBM_FILE dbm;
{
datum key;
VALUE str = rb_obj_alloc(rb_cString);
VALUE str;
key = gdbm_firstkey(dbm);
if (key.dptr == 0)
return Qnil;
RSTRING(str)->ptr = 0;
str = rb_obj_alloc(rb_cString);
RSTRING(str)->len = key.dsize;
RSTRING(str)->aux.capa = key.dsize;
RSTRING(str)->ptr = REALLOC_N(key.dptr,char,key.dsize+1);
@ -228,7 +228,7 @@ rb_gdbm_nextkey(dbm, keystr)
VALUE keystr;
{
datum key, key2;
VALUE str = rb_obj_alloc(rb_cString);
VALUE str;
key.dptr = RSTRING(keystr)->ptr;
key.dsize = RSTRING(keystr)->len;
@ -236,7 +236,7 @@ rb_gdbm_nextkey(dbm, keystr)
if (key2.dptr == 0)
return Qnil;
RSTRING(str)->ptr = 0;
str = rb_obj_alloc(rb_cString);
RSTRING(str)->len = key2.dsize;
RSTRING(str)->aux.capa = key2.dsize;
RSTRING(str)->ptr = REALLOC_N(key2.dptr,char,key2.dsize+1);