Skip to content

Commit 018837b

Browse files
author
matz
committed
* 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
1 parent 6ffdbac commit 018837b

File tree

18 files changed

+149
-80
lines changed

18 files changed

+149
-80
lines changed

ChangeLog

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,36 @@ Wed Oct 27 09:17:30 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
33
* string.c (str_gsub): use a string object for exception safeness.
44
[ruby-dev:24601]
55

6+
Wed Oct 27 07:38:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
7+
8+
* node.h (NODE_TYPESHIFT): allow 4 more bits for line numbers.
9+
[ruby-talk:117841]
10+
11+
* ruby.h (FL_ABLE): nodes are not subject for flag operations.
12+
13+
* io.c (ARGF_FORWARD): should have specified argv explicitly,
14+
since we no longer have frame->argv saved. [ruby-dev:24602]
15+
616
Tue Oct 26 23:30:39 2004 Dave Thomas <dave@pragprog.com>
717

818
* lib/rdoc/code_objects.rb (RDoc::Context::add_class_or_module):
919
Restore correct :nopdoc: behavior with nested classes and modules.
1020

21+
Tue Oct 26 18:21:29 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
22+
23+
* string.c (RESIZE_CAPA): check string attribute before modifying
24+
capacity member of string structure. [ruby-dev:24594]
25+
26+
Tue Oct 26 11:33:26 2004 David G. Andersen <dga@lcs.mit.edu>
27+
28+
* ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
29+
performance. [ruby-talk:117701]
30+
31+
Tue Oct 26 10:56:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
32+
33+
* sprintf.c (rb_f_sprintf): raise ArgumentError for extra
34+
arguments, unless (digit)$ style used.
35+
1136
Mon Oct 25 18:35:39 2004 WATANABE Hirofumi <eban@ruby-lang.org>
1237

1338
* win32/win32.c (isUNCRoot): should check NUL after '.'.
@@ -24,6 +49,16 @@ Sun Oct 24 00:40:50 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
2449
* eval.c (rb_load, search_required, rb_require_safe, rb_require): use
2550
frozen shared string to avoid outside modification. [ruby-dev:24580]
2651

52+
Sat Oct 23 23:40:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
53+
54+
* io.c (rb_io_fptr_finalize): leave stdin/stdout/stderr open in
55+
interpreter termination. [ruby-dev:24579]
56+
57+
Sat Oct 23 22:18:32 2004 Guy Decoux <ts@moulon.inra.fr>
58+
59+
* eval.c (frame_free): Guy Decoux solved the leak problem.
60+
Thanks. [ruby-core:03549]
61+
2762
Sat Oct 23 00:20:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
2863

2964
* ext/zlib/zlib.c (zstream_append_input): clear klass for z->input

array.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,6 @@ rb_ary_aref(argc, argv, ary)
816816
long beg, len;
817817

818818
if (argc == 2) {
819-
if (SYMBOL_P(argv[0])) {
820-
rb_raise(rb_eTypeError, "Symbol as array index");
821-
}
822819
beg = NUM2LONG(argv[0]);
823820
len = NUM2LONG(argv[1]);
824821
if (beg < 0) {
@@ -834,9 +831,6 @@ rb_ary_aref(argc, argv, ary)
834831
if (FIXNUM_P(arg)) {
835832
return rb_ary_entry(ary, FIX2LONG(arg));
836833
}
837-
if (SYMBOL_P(arg)) {
838-
rb_raise(rb_eTypeError, "Symbol as array index");
839-
}
840834
/* check if idx is Range */
841835
switch (rb_range_beg_len(arg, &beg, &len, RARRAY(ary)->len, 0)) {
842836
case Qfalse:
@@ -1178,12 +1172,6 @@ rb_ary_aset(argc, argv, ary)
11781172
long offset, beg, len;
11791173

11801174
if (argc == 3) {
1181-
if (SYMBOL_P(argv[0])) {
1182-
rb_raise(rb_eTypeError, "Symbol as array index");
1183-
}
1184-
if (SYMBOL_P(argv[1])) {
1185-
rb_raise(rb_eTypeError, "Symbol as subarray length");
1186-
}
11871175
rb_ary_update(ary, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]);
11881176
return argv[2];
11891177
}
@@ -1194,9 +1182,6 @@ rb_ary_aset(argc, argv, ary)
11941182
offset = FIX2LONG(argv[0]);
11951183
goto fixnum;
11961184
}
1197-
if (SYMBOL_P(argv[0])) {
1198-
rb_raise(rb_eTypeError, "Symbol as array index");
1199-
}
12001185
if (rb_range_beg_len(argv[0], &beg, &len, RARRAY(ary)->len, 1)) {
12011186
/* check if idx is Range */
12021187
rb_ary_update(ary, beg, len, argv[1]);

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ freebsd*) LIBS="-lm $LIBS"
348348
rb_cv_supplementary_lib_c_r=no,
349349
rb_cv_supplementary_lib_c_r=yes,
350350
rb_cv_supplementary_lib_c_r=yes)])
351-
if test ; then
351+
if test "$rb_cv_supplementary_lib_c_r" = yes; then
352352
MAINLIBS="-lc_r $MAINLIBS"
353353
fi
354354
fi

eval.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7737,19 +7737,27 @@ blk_mark(data)
77377737
}
77387738

77397739
static void
7740-
blk_free(data)
7741-
struct BLOCK *data;
7742-
{
7740+
frame_free(frame)
77437741
struct FRAME *frame;
7744-
void *tmp;
7742+
{
7743+
struct FRAME *tmp;
77457744

7746-
frame = data->frame.prev;
7745+
frame = frame->prev;
77477746
while (frame) {
77487747
tmp = frame;
77497748
frame = frame->prev;
77507749
free(tmp);
77517750
}
7751+
}
7752+
7753+
static void
7754+
blk_free(data)
7755+
struct BLOCK *data;
7756+
{
7757+
void *tmp;
7758+
77527759
while (data) {
7760+
frame_free(&data->frame);
77537761
tmp = data;
77547762
data = data->prev;
77557763
free(tmp);

ext/openssl/ossl_ssl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,6 @@ ossl_ssl_write(VALUE self, VALUE str)
544544
{
545545
SSL *ssl;
546546
int nwrite = 0;
547-
FILE *fp;
548547

549548
Data_Get_Struct(self, SSL, ssl);
550549
StringValue(str);

ext/zlib/zlib.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ zstream_run(z, src, len, flush)
701701
uInt n;
702702
int err;
703703

704-
if (len == 0) {
704+
if (NIL_P(z->input) && len == 0) {
705705
z->stream.next_in = "";
706706
z->stream.avail_in = 0;
707707
}
@@ -3137,15 +3137,26 @@ gzreader_skip_linebreaks(gz)
31373137
gzfile_calc_crc(gz, str);
31383138
}
31393139

3140+
static void
3141+
rscheck(rsptr, rslen, rs)
3142+
char *rsptr;
3143+
long rslen;
3144+
VALUE rs;
3145+
{
3146+
if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen)
3147+
rb_raise(rb_eRuntimeError, "rs modified");
3148+
}
3149+
31403150
static VALUE
31413151
gzreader_gets(argc, argv, obj)
31423152
int argc;
31433153
VALUE *argv;
31443154
VALUE obj;
31453155
{
31463156
struct gzfile *gz = get_gzfile(obj);
3147-
VALUE rs, dst;
3148-
char *rsptr, *p;
3157+
volatile VALUE rs;
3158+
VALUE dst;
3159+
char *rsptr, *p, *res;
31493160
long rslen, n;
31503161
int rspara;
31513162

@@ -3187,16 +3198,24 @@ gzreader_gets(argc, argv, obj)
31873198
gzfile_read_more(gz);
31883199
}
31893200

3190-
n = rslen;
31913201
p = RSTRING(gz->z.buf)->ptr;
3202+
n = rslen;
31923203
for (;;) {
31933204
if (n > gz->z.buf_filled) {
31943205
if (ZSTREAM_IS_FINISHED(&gz->z)) break;
31953206
gzfile_read_more(gz);
31963207
p = RSTRING(gz->z.buf)->ptr + n - rslen;
31973208
}
3198-
if (memcmp(p, rsptr, rslen) == 0) break;
3199-
p++, n++;
3209+
if (!rspara) rscheck(rsptr, rslen, rs);
3210+
res = memchr(p, rsptr[0], (gz->z.buf_filled - n + 1));
3211+
if (!res) {
3212+
n = gz->z.buf_filled + 1;
3213+
} else {
3214+
n += (long)(res - p);
3215+
p = res;
3216+
if (rslen == 1 || memcmp(p, rsptr, rslen) == 0) break;
3217+
p++, n++;
3218+
}
32003219
}
32013220

32023221
gz->lineno++;

gc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,15 @@ rb_gc_start()
14221422
return Qnil;
14231423
}
14241424

1425+
void
1426+
ruby_set_stack_size(size)
1427+
size_t size;
1428+
{
1429+
#ifndef STACK_LEVEL_MAX
1430+
STACK_LEVEL_MAX = size/sizeof(VALUE);
1431+
#endif
1432+
}
1433+
14251434
void
14261435
Init_stack(addr)
14271436
VALUE *addr;
@@ -1752,7 +1761,7 @@ rb_gc_copy_finalizer(dest, obj)
17521761
if (st_lookup(finalizer_table, obj, &table)) {
17531762
st_insert(finalizer_table, dest, table);
17541763
}
1755-
RBASIC(dest)->flags |= FL_FINALIZE;
1764+
FL_SET(dest, FL_FINALIZE);
17561765
}
17571766

17581767
static VALUE

intern.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ char *rb_path_skip_prefix _((const char *));
235235
char *rb_path_last_separator _((const char *));
236236
char *rb_path_end _((const char *));
237237
/* gc.c */
238+
void ruby_set_stack_size _((size_t));
238239
NORETURN(void rb_memerror __((void)));
239240
int ruby_stack_check _((void));
240241
int ruby_stack_length _((VALUE**));

0 commit comments

Comments
 (0)