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

* node.h (NODE_TYPESHIFT): allow 4 more bits for line numbers.

[ruby-talk:117841]

* ruby.h (FL_ABLE): nodes are not subject for flag operations.

* io.c (ARGF_FORWARD): should have specified argv explicitly,
  since we no longer have frame->argv saved.  [ruby-dev:24602]

* string.c (RESIZE_CAPA): check string attribute before modifying
  capacity member of string structure.  [ruby-dev:24594]

* ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
  performance.  [ruby-talk:117701]

* sprintf.c (rb_f_sprintf): raise ArgumentError for extra
  arguments, unless (digit)$ style used.

* io.c (rb_io_fptr_finalize): leave stdin/stdout/stderr open in
  interpreter termination.  [ruby-dev:24579]

* eval.c (frame_free): Guy Decoux solved the leak problem.
  Thanks.  [ruby-core:03549]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-10-27 09:29:26 +00:00
parent 6ffdbac5ed
commit 018837b84f
18 changed files with 149 additions and 80 deletions

View file

@ -701,7 +701,7 @@ zstream_run(z, src, len, flush)
uInt n;
int err;
if (len == 0) {
if (NIL_P(z->input) && len == 0) {
z->stream.next_in = "";
z->stream.avail_in = 0;
}
@ -3137,6 +3137,16 @@ gzreader_skip_linebreaks(gz)
gzfile_calc_crc(gz, str);
}
static void
rscheck(rsptr, rslen, rs)
char *rsptr;
long rslen;
VALUE rs;
{
if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen)
rb_raise(rb_eRuntimeError, "rs modified");
}
static VALUE
gzreader_gets(argc, argv, obj)
int argc;
@ -3144,8 +3154,9 @@ gzreader_gets(argc, argv, obj)
VALUE obj;
{
struct gzfile *gz = get_gzfile(obj);
VALUE rs, dst;
char *rsptr, *p;
volatile VALUE rs;
VALUE dst;
char *rsptr, *p, *res;
long rslen, n;
int rspara;
@ -3187,16 +3198,24 @@ gzreader_gets(argc, argv, obj)
gzfile_read_more(gz);
}
n = rslen;
p = RSTRING(gz->z.buf)->ptr;
n = rslen;
for (;;) {
if (n > gz->z.buf_filled) {
if (ZSTREAM_IS_FINISHED(&gz->z)) break;
gzfile_read_more(gz);
p = RSTRING(gz->z.buf)->ptr + n - rslen;
}
if (memcmp(p, rsptr, rslen) == 0) break;
p++, n++;
if (!rspara) rscheck(rsptr, rslen, rs);
res = memchr(p, rsptr[0], (gz->z.buf_filled - n + 1));
if (!res) {
n = gz->z.buf_filled + 1;
} else {
n += (long)(res - p);
p = res;
if (rslen == 1 || memcmp(p, rsptr, rslen) == 0) break;
p++, n++;
}
}
gz->lineno++;