mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* marshal.c (r_object): better allocation type check for
TYPE_UCLASS. usage of allocation framework is disabled for now. * variable.c (rb_class_path): Module may have subclass. * string.c (rb_str_update): should maintain original negative offset. * string.c (rb_str_subpat_set): ditto * string.c (rb_str_aset): ditto. * re.c (rb_reg_nth_match): should check negative nth. * re.c (rb_reg_nth_defined): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d902111a57
commit
1fe40b7cc5
25 changed files with 349 additions and 342 deletions
|
@ -159,18 +159,17 @@ rb_gdbm_fetch(dbm, key)
|
|||
datum key;
|
||||
{
|
||||
datum val;
|
||||
NEWOBJ(str, struct RString);
|
||||
OBJSETUP(str, rb_cString, T_STRING);
|
||||
VALUE str = rb_obj_alloc(rb_cString);
|
||||
|
||||
val = gdbm_fetch(dbm, key);
|
||||
if (val.dptr == 0)
|
||||
return Qnil;
|
||||
|
||||
str->ptr = 0;
|
||||
str->len = val.dsize;
|
||||
str->orig = 0;
|
||||
str->ptr = REALLOC_N(val.dptr,char,val.dsize+1);
|
||||
str->ptr[str->len] = '\0';
|
||||
RSTRING(str)->ptr = 0;
|
||||
RSTRING(str)->len = val.dsize;
|
||||
RSTRING(str)->orig = 0;
|
||||
RSTRING(str)->ptr = REALLOC_N(val.dptr,char,val.dsize+1);
|
||||
RSTRING(str)->ptr[str->len] = '\0';
|
||||
|
||||
OBJ_TAINT(str);
|
||||
return (VALUE)str;
|
||||
|
@ -207,18 +206,17 @@ rb_gdbm_firstkey(dbm)
|
|||
GDBM_FILE dbm;
|
||||
{
|
||||
datum key;
|
||||
NEWOBJ(str, struct RString);
|
||||
OBJSETUP(str, rb_cString, T_STRING);
|
||||
VALUE str = rb_obj_alloc(rb_cString);
|
||||
|
||||
key = gdbm_firstkey(dbm);
|
||||
if (key.dptr == 0)
|
||||
return Qnil;
|
||||
|
||||
str->ptr = 0;
|
||||
str->len = key.dsize;
|
||||
str->orig = 0;
|
||||
str->ptr = REALLOC_N(key.dptr,char,key.dsize+1);
|
||||
str->ptr[str->len] = '\0';
|
||||
RSTRING(str)->ptr = 0;
|
||||
RSTRING(str)->len = key.dsize;
|
||||
RSTRING(str)->orig = 0;
|
||||
RSTRING(str)->ptr = REALLOC_N(key.dptr,char,key.dsize+1);
|
||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||
|
||||
OBJ_TAINT(str);
|
||||
return (VALUE)str;
|
||||
|
@ -230,8 +228,7 @@ rb_gdbm_nextkey(dbm, keystr)
|
|||
VALUE keystr;
|
||||
{
|
||||
datum key, key2;
|
||||
NEWOBJ(str, struct RString);
|
||||
OBJSETUP(str, rb_cString, T_STRING);
|
||||
VALUE str = rb_obj_alloc(rb_cString);
|
||||
|
||||
key.dptr = RSTRING(keystr)->ptr;
|
||||
key.dsize = RSTRING(keystr)->len;
|
||||
|
@ -239,11 +236,11 @@ rb_gdbm_nextkey(dbm, keystr)
|
|||
if (key2.dptr == 0)
|
||||
return Qnil;
|
||||
|
||||
str->ptr = 0;
|
||||
str->len = key2.dsize;
|
||||
str->orig = 0;
|
||||
str->ptr = REALLOC_N(key2.dptr,char,key2.dsize+1);
|
||||
str->ptr[str->len] = '\0';
|
||||
RSTRING(str)->ptr = 0;
|
||||
RSTRING(str)->len = key2.dsize;
|
||||
RSTRING(str)->orig = 0;
|
||||
RSTRING(str)->ptr = REALLOC_N(key2.dptr,char,key2.dsize+1);
|
||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||
|
||||
OBJ_TAINT(str);
|
||||
return (VALUE)str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue