Граф коммитов

192 Коммитов

Автор SHA1 Сообщение Дата
ocean 08133b1344 * dir.c, eval.c, parse.y, process.c, ruby.c: avoid warning "unused
variable" [ruby-dev:26387]

* dir.c (glob_helper): avoid warning "enumeration value `RECURSIVE'
  not handled in switch" [ruby-dev:26392]

(patch from Kazuhiro NISHIYAMA)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-28 13:08:32 +00:00
eban dd2d4bc29b * dir.c (glob_helper): check whether path is "" before calling
do_opendir.  [ruby-dev:26183]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-18 08:41:50 +00:00
nobu b272844547 * dir.c (glob_helper): get rid of using String. [ruby-dev:26180]
* eval.c (ruby_options), win32/win32.c (NtInitialize): move argument
  intialization back.  [ruby-dev:26180]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-18 02:08:00 +00:00
eban 4f6e8bade5 * dir.c, file.c (lstat): avoid warnings for mingw.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-04-11 13:30:10 +00:00
ocean 4b0f7cecc4 * dir.c (rb_glob): fixed mismatch of argument.
* dir.c (fnmatch): removed unnecessary code. (by string.c 1.219)

* win32/win32.c (NtInitialize): ditto. (by numeric.c 1.117)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-05 09:30:24 +00:00
matz 70bbad3cfd * array.c: replace rb_protect_inspect() and rb_inspecting_p() by
rb_exec_recursive() in eval.c.

* eval.c (rb_exec_recursive): new function.

* array.c (rb_ary_join): use rb_exec_recursive().

* array.c (rb_ary_inspect, rb_ary_hash): ditto.

* file.c (rb_file_join): ditto.

* hash.c (rb_hash_inspect, rb_hash_to_s, rb_hash_hash): ditto.

* io.c (rb_io_puts): ditto.

* object.c (rb_obj_inspect): ditto

* struct.c (rb_struct_inspect): ditto.

* lib/set.rb (SortedSet::setup): a hack to shut up warning.
  [ruby-talk:132866]

* lib/time.rb (Time::strptime): add new function.  inspired by
  [ruby-talk:132815].

* lib/parsedate.rb (ParseDate::strptime): ditto.

* regparse.c: move st_*_strend() functions from st.c.  fixed some
  potential memory leaks.

* exception error messages updated.  [ruby-core:04497]

* ext/socket/socket.c (Init_socket): add bunch of Socket
  constants.  Patch from Sam Roberts <sroberts@uniserve.com>.
  [ruby-core:04409]

* array.c (rb_ary_s_create): no need for negative argc check.
  [ruby-core:04463]

* array.c (rb_ary_unshift_m): ditto.

* lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass
  of StandardError class, not Exception class.  [ruby-core:04429]

* parse.y (fcall_gen): lvar(arg) will be evaluated as
  lvar.call(arg) when lvar is a defined local variable. [new]

* object.c (rb_class_initialize): call inherited method before
  calling initializing block.

* eval.c (rb_thread_start_1): initialize newly pushed frame.

* lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE.
  fixed: [ruby-core:04444]

* eval.c (is_defined): NODE_IASGN is an assignment.

* ext/readline/readline.c (Readline.readline): use rl_outstream
  and rl_instream.  [ruby-dev:25699]

* ext/etc/etc.c (Init_etc): sGroup needs HAVE_ST_GR_PASSWD check
  [ruby-dev:25675]

* misc/ruby-mode.el: [ruby-core:04415]

* lib/rdoc/generators/html_generator.rb: [ruby-core:04412]

* lib/rdoc/generators/ri_generator.rb: ditto.

* struct.c (make_struct): fixed: [ruby-core:04402]

* ext/curses/curses.c (window_color_set): [ruby-core:04393]

* ext/socket/socket.c (Init_socket): SO_REUSEPORT added.
  [ruby-talk:130092]

* object.c: [ruby-doc:818]

* parse.y (open_args): fix too verbose warnings for the space
  before argument parentheses.  [ruby-dev:25492]

* parse.y (parser_yylex): ditto.

* parse.y (parser_yylex): the first expression in the parentheses
  should not be a command.  [ruby-dev:25492]

* lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330]

* object.c (Init_Object): remove Object#type.  [ruby-core:04335]

* st.c (st_foreach): report success/failure by return value.
  [ruby-Bugs-1396]

* parse.y: forgot to initialize parser struct.  [ruby-dev:25492]

* parse.y (parser_yylex): no tLABEL on EXPR_BEG.
  [ruby-talk:127711]

* document updates - [ruby-core:04296], [ruby-core:04301],
  [ruby-core:04302], [ruby-core:04307]

* dir.c (rb_push_glob): should work for NUL delimited patterns.

* dir.c (rb_glob2): should aware of offset in the pattern.

* string.c (rb_str_new4): should propagate taintedness.

* env.h: rename member names in struct FRAME; last_func -> callee,
  orig_func -> this_func, last_class -> this_class.

* struct.c (rb_struct_set): use original method name, not callee
  name, to retrieve member slot.  [ruby-core:04268]

* time.c (time_strftime): protect from format modification from GC
  finalizers.

* object.c (Init_Object): remove rb_obj_id_obsolete()

* eval.c (rb_mod_define_method): incomplete subclass check.
  [ruby-dev:25464]

* gc.c (rb_data_object_alloc): klass may be NULL.
  [ruby-list:40498]

* bignum.c (rb_big_rand): should return positive random number.
  [ruby-dev:25401]

* bignum.c (rb_big_rand): do not use rb_big_modulo to generate
  random bignums.  [ruby-dev:25396]

* variable.c (rb_autoload): [ruby-dev:25373]

* eval.c (svalue_to_avalue): [ruby-dev:25366]

* string.c (rb_str_justify): [ruby-dev:25367]

* io.c (rb_f_select): [ruby-dev:25312]

* ext/socket/socket.c (sock_s_getservbyport): [ruby-talk:124072]

* struct.c (make_struct): [ruby-dev:25249]

* dir.c (dir_open_dir): new function.  [ruby-dev:25242]

* io.c (rb_f_open): add type check for return value from to_open.

* lib/pstore.rb (PStore#transaction): Use the empty content when a
  file is not found.  [ruby-dev:24561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-04 06:47:45 +00:00
usa 571e1361b6 * io.c (dir_s_mkdir): win32 special processing doesn't need any longer.
* win32/win32.[ch] (rb_w32_mkdir): new function. POSIX.1 compatible
  interface.

* win32/win32.[ch] (rb_w32_rmdir): new function.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-07 04:45:46 +00:00
matz f50136a311 * file.c (rb_file_chown): integer conversion should be prior to
GetOpenFile().  [ruby-dev:24947]

* file.c (rb_file_truncate): ditto.

* file.c (rb_file_s_truncate): ditto.

* dir.c (dir_seek): use NUM2OFFT().

* misc/ruby-mode.el (ruby-non-block-do-re): [ruby-core:03719]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-22 15:26:02 +00:00
matz fec64f7fe2 * dir.c (dir_seek): should retrieve dir_data after NUM2INT().
[ruby-dev:24941]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-21 15:33:56 +00:00
nobu 9c1e33fc45 * dir.c (rb_push_glob): fix overrun. [ruby-dev:24886]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-17 04:05:18 +00:00
matz 9f3d5e7172 * dir.c (rb_glob): should have called rb_glob_caller().
[ruby-dev:24773]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-11 08:59:20 +00:00
nobu 765c6a80e6 * dir.c (glob_helper): path is a string object now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-10 10:48:01 +00:00
matz 683400f427 * dir.c (rb_glob2): do not allocate buffer from heap to avoid
memory leaks.  use string object for buffering instead.
  [ruby-dev:24738]

* dir.c (join_path): ditto.

* io.c (io_read): external input buffer may be modified even after
  rb_str_locktmp().  [ruby-dev:24735]

* dir.c (fnmatch): p or s may be NULL.  [ruby-dev:24749]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-10 07:17:53 +00:00
matz 1057902ac7 * io.c (read_all): block string buffer modification during
rb_io_fread() by freezing it temporarily. [ruby-dev:24479]

* dir.c (rb_push_glob): block call at once the end of method.
  [ruby-dev:24487]

* ext/enumerator/enumerator.c (enum_each_slice): remove
  rb_gc_force_recycle() to prevent potential SEGV.
  [ruby-dev:24499]

* ext/zlib/zlib.c (zstream_expand_buffer): hide internal string
  buffer by clearing klass.  [ruby-dev:24510]

* ext/socket/socket.c (sock_s_getservbyaname): protocol string
  might be altered.  [ruby-dev:24503]

* string.c (rb_str_upto): check if return value from succ is a
  string.  [ruby-dev:24504]

* io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
  avoid mode string modification.  [ruby-dev:24454]

* io.c (rb_io_getline_fast): should take delim as unsigned char to
  distinguish EOF and '\377'.  [ruby-dev:24460]

* io.c (rb_io_getline): add check for RS modification.
  [ruby-dev:24461]

* enum.c (enum_sort_by): use qsort() directly instead using
  rb_iterate().  [ruby-dev:24462]

* enum.c (enum_each_with_index): remove rb_gc_force_recycle() to
  prevent access to recycled object (via continuation for
  example).  [ruby-dev:24463]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19 10:25:23 +00:00
matz bfabc05a43 * enum.c (enum_sort_by): do not use qsort directly. use
rb_ary_sort_bang() instead.  [ruby-dev:24291]

* enum.c (enum_sort_by): pedantic type check added.
  [ruby-dev:24291]

* hash.c (rb_hash_foreach_iter): check iter_lev after each
  iteration.  [ruby-dev:24289]

* array.c (rb_ary_and): element size might change during
  comparison.  [ruby-dev:24290]

* array.c (rb_ary_or): ditto. [ruby-dev:24292]

* array.c (rb_ary_equal): wrong fix. [ruby-dev:24286]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-21 03:08:33 +00:00
matz e77ddaf0d1 * array.c (rb_ary_delete): element comparison might change array
size. [ruby-dev:24273]

* parse.y: make ruby parser reentrant. merge ripper parser to the
  real one.  this change makes ruby require bison.

* file.c (rb_file_truncate): clear stdio buffer before truncating
  the file.  [ruby-dev:24191]

* ext/digest/digest.c: use rb_obj_class() instead of CLASS_OF
  which might return singleton class.  [ruby-dev:24202]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-17 09:24:13 +00:00
matz d73fa69935 * dir.c (free_dir): fix memory leak. reported by yamamoto
madoka.

* eval.c (bind_eval): new method. [RCR 251]

* string.c (rb_str_clear): new method. [ruby-dev:24104]

* io.c (rb_io_reopen): should clear allocated OpenFile.  pointed
  out by Guy Decoux. [ruby-core:03288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-19 07:33:15 +00:00
dave 541d9d3536 Roll in Austin Ziegler's patch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-09 03:54:15 +00:00
knu 5b42ef645e * dir.c (bracket): use NULL instead of 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-17 18:20:57 +00:00
ocean 82593c058f * dir.c: RDOC for File::FNM_CASEFOLD was missed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-12 05:18:23 +00:00
ocean f77db2ed9c * dir.c (rb_push_glob): simplified code (not change behavior)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-06 05:42:48 +00:00
ocean 51ab50efd3 * dir.c: Updated RDocs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-19 11:59:33 +00:00
ocean c2642b2c3f * dir.c: Updated RDocs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-19 09:31:39 +00:00
ocean da2ace5c40 * dir.c (rb_push_glob): Dir.glob() should return nil if block is given.
(http://www.ruby-lang.org/ja/man/index.cgi?cmd=view;name=Dir)

* dir.c (push_braces): Dir.glob() should handle '{ }' nested more than
  3 times.

* dir.c (push_braces, rb_push_glob): Dir.glob() should handle escaped
  '{' and '}' and ','.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-15 10:32:09 +00:00
ocean 4c4d155e3d * dir.c (rb_glob2, rb_glob, push_globs, push_braces, rb_push_glob):
fix memory leak to occur when block is interrupted in Dir.glob.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-12 01:45:27 +00:00
ocean ae9512fcf6 * dir.c (has_magic, find_dirsep): incomplete '[' matches no character
in Dir.glob. (follows File.fnmatch's behavior)

* dir.c (fnmatch_helper): incomplete escape is ignored in File.fnmatch.
  (follows Dir.glob's behavior)

* dir.c (find_dirsep): '/' between '[' and ']' is ignored in Dir.glob.
  (follows File.fnmatch with File::FNM_PATHNAME 's behavior)

* dir.c (find_dirsep): escaped slash '\/' loses its meaning as
  directory separator in Dir.glob.

[ruby-dev:23291]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-09 08:06:01 +00:00
matz df84c64be9 * pack.c (pack_pack): use NUM2INT() instead of num2i32().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-07 06:30:15 +00:00
matz 4ded52b623 * file.c (rb_get_path): get path string via "to_path" method if
path object is not a string. [Ruby2]

* gc.c (rb_gc_call_finalizer_at_exit): do not free threads in the
  exit finalizers.

* io.c (rb_io_reopen): should use rb_io_check_io().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-07 02:51:05 +00:00
ocean 7307c01906 * dir.c (fnmatch_helper): File.fnmatch('\.', '.') should return true.
(Rev1.112 lost compatiblity)

* dir.c (fnmatch_helper): File.fnmatch('\/', '/', File::FNM_PATHNAME)
  should return true. (Rev1.112 lost compatiblity)

* dir.c (fnmatch): '**/' shouldn't match leading period unless
  File::FNM_DOTMATCH is set.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-16 02:24:47 +00:00
ocean c6e5374aae * dir.c (fnmatch):
directory recursion '**/' can be used with File::FNM_PATHNAME.
  [ruby-dev:22901]

* dir.c (fnmatch_helper):
  only '/' is accepted as path separator even in DOSISH environment.
  [ruby-dev:22974] [ruby-list:39337]

* dir.c (fnmatch_helper):
  faster '*' matching.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-12 15:00:39 +00:00
ocean f34d501658 * dir.c (range): Cancel change for incomplete '['. More discussion
is needed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-08 12:14:49 +00:00
ocean 6901d03914 * dir.c (range): treat incomplete '[' as ordinary character (like
has_magic does). fix buffer overrun at incomplete escape like '[\'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-08 06:10:22 +00:00
ocean b381815014 * dir.c (glob_helper): '**/' should not match leading period
unless File::FNM_DOTMATCH is set. (like '*/')


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-24 09:49:59 +00:00
ocean 77d7ff7cbe * dir.c (fnmatch): File.fnmatch with FNM_PATHNAME was broken
for the pattern including '*' followed by '/'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-24 08:17:10 +00:00
ocean ba60b3f25f * dir.c (CompareImpl): File.fnmatch and Dir.glob get better performance
in Win32. This is achived by calling downcase() for single-byte
  characters. CharLower() is only called for multi-byte characters.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-16 01:33:12 +00:00
ocean 5e379106b5 * dir.c (push_braces): remove wrong const.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-15 12:00:51 +00:00
ocean 30fd29a174 * ruby.h, dir.c (rb_glob): add const.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-15 06:34:21 +00:00
ocean 3a8647ea9f * dir.c (glob_helper): Dir.glob('**/') did not work.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-08 01:07:09 +00:00
ocean c887d20966 Did some styles (no change to behavior)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-07 14:22:33 +00:00
ocean b839a4d720 * dir.c (fnmatch):
File.fnmatch('\[1\]' , '[1]') should return true. [ruby-dev:22815]
  File.fnmatch('*?', 'a') should return true. [ruby-dev:22819]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-07 12:51:57 +00:00
matz 0ae750341e * dir.c (glob_helper): infinite loop bug in win32 code.
[ruby-dev:22770]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-29 11:59:55 +00:00
matz 7a987b9bcd * dir.c: merge tuning from H.Yamamoto <ocean@m2.ccsnet.ne.jp>.
[ruby-dev:22761]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-29 08:05:29 +00:00
siena fc69b2a7f6 * defines.h: define RUBY_MBCHAR_MAX instead of MB_CUR_MAX.
* dir.c (Next, emx_mblen): use RUBY_MBCHAR_MAX for mblen().
* file.c (CharNext): ditto.
* ruby.c (translate_char): ditto.
* util.c (__crt0_glob_function): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-21 15:26:11 +00:00
nobu 53157197d2 * dir.c (dir_inspect): new method, Dir#inspect. [ruby-dev:22562]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-10 13:46:21 +00:00
nobu 0f3e58e707 * dir.c (glob_helper): should not recurse in exceptional status.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-08 09:25:32 +00:00
nobu debe0485f0 * dir.c (glob_helper): fix memory leak.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-07 13:28:15 +00:00
matz caaac4db27 * dir.c: merge tuning from H.Yamamoto <ocean@m2.ccsnet.ne.jp>.
[ruby-dev:22486]

* pack.c (pack_unpack): unpack requires big endian offet (OFF16B
  and OFF32B).  The patch is from Minero Aoki in [ruby-dev:22489]

* pack.c (OFF16B): add big-endian offset again.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-05 10:01:54 +00:00
matz 59dbfa3e4c * dir.c: merge tuning from H.Yamamoto <ocean@m2.ccsnet.ne.jp>.
[ruby-dev:22476]

* io.c (argf_eof): ARGF.eof? should not have any side effect.
  [ruby-dev:22469]

* io.c (argf_each_byte): should return self.  [ruby-dev:22465]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-02 16:21:26 +00:00
dave 5076ed519b Document Class and Dir
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-19 15:18:09 +00:00
nobu 77ffc8bf3f * dir.c (fnmatch): unlike find_dirsep(), rb_path_next() never
return NULL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-18 07:38:48 +00:00
nobu 52f81e0ce7 commit miss
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-15 04:11:34 +00:00
nobu 12b5b81a97 * dir.c (check_dirname): check string safety and remove extraneous
trailing directory separators.  [ruby-dev:22279]

* file.c: extern rb_path_next, rb_path_skip_prefix,
  rb_path_last_separator, rb_path_end.

* intern.h: prototypes for rb_path_next, rb_path_skip_prefix,
  rb_path_last_separator, rb_path_end.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-15 04:07:03 +00:00
matz 6212cfb9c5 * gc.c (Init_stack): stack region is far smaller than usual if
pthread is used.

* marshal.c (w_extended): singleton methods should not be checked
  when dumping via marshal_dump() or _dump(). [ruby-talk:85909]

* file.c (getcwdofdrv): avoid using getcwd() directly, use
  my_getcwd() instead.

* merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine
  <sunshine@sunshineco.com>.  [ruby-core:01596]

* marshal.c (w_object): LINK check earlier than anything else,
  i.e. do not dump TYPE_IVAR for already dumped objects.
  (ruby-bugs PR#1220)

* eval.c (rb_eval): call "inherited" only when a new class is
  generated; not on reopening.

* eval.c (eval): prepend error position in evaluating string to

* configure.in: revived NextStep, OpenStep, and Rhapsody ports which
  had become unbuildable; enhanced --enable-fat-binary option so that
  it accepts a list of desired architectures (rather than assuming a
  fixed list), or defaults to a platform-appropriate list if user does
  not provide an explicit list; made the default list of architectures
  for MAB (fat binary) more comprehensive; now uses -fno-common even
  when building the interpreter (in addition to using it for
  extensions), thus allowing the interpreter to be embedded into a
  plugin module of an external project (in addition to allowing
  embedding directly into an application); added checks for
  <netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now
  ensures that -I/usr/local/include is employed when extensions'
  extconf.rb scripts invoke have_header() since extension checks on
  NextStep and OpenStep will fail without it if the desired resource
  resides in the /usr/local tree; fixed formatting of --help message.

* Makefile.in: $(LIBRUBY_A) rule now deletes the archive before
  invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives
  (see configure's --enable-fat-binary option); added rule for new
  missing/getcwd.c.

* defines.h: fixed endian handling during MAB build (see configure's
  --enable-fat-binary option) to ensure that all portions of the
  project see the correct WORDS_BIGENDIAN value (some extension modules
  were getting the wrong endian setting); added missing constants
  GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep
  and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H
  define in NeXT section.

* dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on
  NextStep since, on some installations, this value always resolves
  uselessly to zero.

* dln.c: added error reporting to NextStep extension loader since the
  previous behavior of failing silently was not useful; now ensures
  that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined
  for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice
  on Rhapsody since this header lacks multiple-include protection,
  which resulted in "redefinition" compilation errors.

* main.c: also create hard reference to objc_msgSend() on NeXT
  platforms (in addition to Apple platforms).

* lib/mkmf.rb: now exports XCFLAGS from configure script to extension
  makefiles so that extensions can be built MAB (see configure's
  --enable-fat-binary option); also utilize XCFLAGS in cc_command()
  (but not cpp_command() because MAB flags are incompatible with
  direct invocation of `cpp').

* ext/curses/extconf.rb: now additionally checks for presence of these
  curses functions which are not present on NextStep or Openstep:
  bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(),
  setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(),
  wscrl(), wsetscrreg()

* ext/curses/curses.c: added appropriate #ifdef's for additional set of
  curses functions now checked by extconf.rb; fixed curses_bkgd() and
  window_bkgd() to correctly return boolean result rather than numeric
  result; fixed window_getbkgd() to correctly signal an error by
  returning nil rather than -1.

* ext/etc/etc.c: setup_passwd() and setup_group() now check for null
  pointers before invoking rb_tainted_str_new2() upon fields extracted
  from `struct passwd' and `struct group' since null pointers in some
  fields are common on NextStep/OpenStep (especially so for the
  `pw_comment' field) and rb_tainted_str_new2() throws an exception
  when it receives a null pointer.

* ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for
  platforms such as NextStep and OpenStep which lack strdup().

* ext/socket/getaddrinfo.c: cast first argument of getservbyname(),
  gethostbyaddr(), and gethostbyname() from (const char*) to non-const
  (char*) for older platforms such as NextStep and OpenStep.

* ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for
  platforms such as NextStep and OpenStep which lack strdup(); include
  <netinet/in_systm.h> if present for NextStep and OpenStep; cast first
  argument of gethostbyaddr() and getservbyname() from (const char*) to
  non-const (char*) for older platforms.

* ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for
  platforms such as NextStep and OpenStep which lack strdup().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-22 04:00:03 +00:00
nobu 43e4a50015 * dir.c (glob_helper): preserve raw order for **.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-18 02:23:13 +00:00
nobu 69459d98ef * dir.c (find_dirsep): get rid of warnings.
* eval.c (error_print): temporary value might be disposed by GC.

* hash.c (env_has_value, env_index): should not increment NULL.

* io.c (io_read, rb_io_sysread): not read when length is 0.

* io.c (rb_io_reopen): ensure initialized IO.

* io.c (rb_io_init_copy): sychronize file pointer.

* io.c (rb_io_s_pipe): make exception proof.

* string.c (rb_str_rindex_m): Fixnum 0 matched end of string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23 08:41:07 +00:00
matz 9ac15a773d * dir.c (push_braces): do not push_braces() unless rbrace is found.
(ruby-bugs-ja:PR#469)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 15:54:37 +00:00
matz d4db9e9c60 * io.c (rb_io_initialize): should check rb_secure(4).
* dir.c (dir_s_getwd): should check rb_secure(4).

* object.c (rb_obj_infect): function version of OBJ_INFECT().

* eval.c (rb_secure_update): new function to check object update.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-25 03:11:27 +00:00
matz d37e836a58 * io.c (rb_io_popen): do not call rb_io_close() directly, call
"close" method instead. [ruby-dev:19717]

* io.c (rb_io_s_open): ditto.

* hash.c (rb_any_hash): remove DEFER_INTS.  all do_hash() calls in
  st.c are at the top of functions.  No reentrant problem.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-04 07:04:11 +00:00
michal 9df466b287 Updated Copyrights of Matz to 2003.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:34:03 +00:00
usa b469f3155a * array.c (ary_alloc), dir.c (dir_s_alloc), eval.c (thgroup_s_alloc),
file.c (rb_stat_s_alloc), hash.c (hash_alloc), io.c (io_alloc),
  object.c (rb_module_s_alloc, rb_class_allocate_instance),
  re.c (match_alloc, rb_reg_s_alloc), string.c (str_alloc),
  time.c (time_s_alloc), ext/digest/digest.c (rb_digest_base_alloc),
  ext/tcltklib/tcltklib.c (ip_alloc),
  ext/win32ole/win32ole.c (fole_s_allocate, fev_s_allocate)
  : add prototype to get rid of VC++ warnings.

* ext/sdbm/init.c (fsdbm_alloc): allocator takes only one argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-21 18:02:01 +00:00
matz bc49bc7c6b * parse.y (do_block): split "do" block and tLBRACE_ARG block.
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule

* parse.y (command): can take optional cmd_brace_block; use %prec
  to resolve shift/reduce conflict. (ruby-bugs-ja PR#372)

* eval.c (ruby_finalize): trace_func should be cleared here (after
  executing exit procs and finalizers).

* eval.c (rb_define_alloc_func): new allocation framework, based
  on Nobu's work [ruby-dev:19116].  "allocate" method is no longer
  used for object allocation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 08:33:17 +00:00
uema2 b19e36a214 * configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
      process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
      bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
      ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
      ext/socket/getnameinfo.c, ext/socket/socket.c,
      ext/tcltklib/stubs.c
      : replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-15 03:18:08 +00:00
matz 90c4dae08f WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-02 07:57:17 +00:00
matz e2d384d628 * file.c (rb_find_file_ext): should not terminate searching with
empty path, just ignore.

* dir.c: remove <sys/parm.h> inclusion.

* compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
  rb_cmpint().

* error.c (init_syserr): remove sys_nerr dependency.

* numeric.c (num_cmp): added to satisfy Comparable assumption.

* eval.c (rb_add_method): "initialize" should be public if it is a
  singleton method.

* regex.c (re_match): avoid dereferencing if size == 0.
  (ruby-bugs-ja:PR#360)

* time.c (time_cmp): should return nil if an operand is not a
  number nor time. (ruby-bugs-ja:PR#359)

* file.c (rb_stat_cmp): should return nil if an operand is not
  File::Stat.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-22 09:14:24 +00:00
nobu 12852c2e9a * dir.c (glob_helper): must not closedir() when exception raised
while globbing "**".

* marshal.c (w_uclass): unused variable.

* re.c (match_clone): unused.

* regex.c (re_compile_pattern): get rid of implicit promotion from
  plain char to int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-25 14:52:37 +00:00
nobu a1ea7b6d56 * dir.c (glob_func_caller): add prototype to get rid of warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-13 14:46:44 +00:00
nobu 66d9f5498b * dir.c (glob_helper): should pass matched path. (ruby-bugs-ja:PR#333)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-12 09:11:12 +00:00
nobu 563885cad6 * dir.c (glob_helper): fixed freeing buffer. (ruby-bugs-ja:PR#332)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-12 08:48:57 +00:00
matz b031fdbc0e * dir.c (glob_helper): prevent memory leak using rb_protect().
* string.c (rb_str_associate): no need to check freeze flag.

* string.c (rb_str_resize): should honor STR_ASSOC flag on
  resize.

* string.c (rb_str_resize): proper STR_ASSOC handling.  pointed
  out by Michal Rokos.

* string.c (rb_str_buf_cat): ditto.

* string.c (rb_str_cat): ditto.

* string.c (rb_str_buf_append): ditto.

* string.c (rb_str_append): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-12 06:27:15 +00:00
knu 7297827ec6 * dir.c (glob_helper): Use lstat() instead of stat() so it catches
a dead symlink.  Given a dead symlink named "a", Dir.glob("?")
  did catch it but Dir.glob("a") somehow didn't.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-15 10:24:38 +00:00
nobu 65ea437148 * dir.c (glob_helper): remove escaping backslashes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-11 01:53:48 +00:00
knu 1e0830c198 Back out the previous commit which was incorrect. I misread the
specification.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-04 00:06:19 +00:00
knu df05c380d6 * dir.c (fnmatch): Make PERIOD() independent of FNM_PATHNAME.
This fixes a bug where fnmatch('/?a', '/.a', 0) returned true.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-03 22:39:40 +00:00
matz e63a990141 * re.c (rb_reg_expr_str): should treat backslash specially in
escaping.

* io.c: complete off_t handling; missing argument for
  fptr_finalize(); polished rb_scan_args call.

* dir.c: wrap multi-statment macro by do { } while (0)

* eval.c, numeric,c, sprintf.c, util.c: ditto.

* bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum,
  Bignum, nor Float.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-18 08:46:18 +00:00
matz b010cccc90 * dir.c (glob_helper): should have proceed link when link->path
was non existing symbolic link.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-10 09:58:39 +00:00
nobu 40ceea0a75 * regex.c (mbc_startpos_func): VC6 seems to be unable to
understand forward declaration for static variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 09:08:15 +00:00
nobu 6dfd299dec * dir.c (rb_push_glob): local variable 'maxnest' was
uninitialized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 08:21:01 +00:00
matz e748f56a6b * ext/socket/socket.c (bsock_do_not_rev_lookup_set): should not be
allowed when $SAFE > 3.

* eval.c (rb_thread_ready): THREAD_TO_KILL threads should not turn
  into THREAD_RUNNABLE on wakeup.

* eval.c (rb_thread_list): THREAD_TO_KILL threads should be in the
  list.

* eval.c (thgroup_list): ditto; by moving gid clearance from
  rb_thread_cleanup().

* dir.c (fnmatch): "*/bar" (with FNM_PATHNAME flag) does not
  match "foo/bar".

* io.c (read_all): files on /proc filesystem with zero stat size,
  may have contents.

* ext/socket/socket.c (tcp_s_gethostbyname): refactored.

* ext/socket/socket.c (sock_s_gethostbyname): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 06:18:07 +00:00
nobu a1f4ea2127 * dir.c (rb_push_glob): avoid SEGV when no block given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-13 23:59:41 +00:00
knu b9522c1687 * dir.c: FNM_PERIOD is obsoleted and FNM_DOTMATCH is introduced
instead, which has the opposite meaning of FNM_PERIOD.

* dir.c: Dir::glob now accepts optional FNM_* flags via the second
  argument, whereas Dir::[] doesn't.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-13 10:11:09 +00:00
matz 7de72c4858 * parse.y (expr_value, arg_value, primary_value): value_expr()
check in place.

* eval.c (block_pass): "&nil" should clear block given.

* dir.c (push_braces): remove MAXPATHLEN dependency.

* dir.c (dir_s_globd): ditto.

* dln.c (init_funcname): ditto.

* dln.c (load_1): ditto.

* dln.c (dln_load): ditto.

* configure.in: add GNU/Hurd switches.

* pack.c (pack_pack): allows comment in template strings.

* pack.c (pack_unpack): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-18 09:52:48 +00:00
matz ba8fc117c5 * parse.y (stmt): local variable declaration order was changed
since 1.6

* parse.y (arg): ditto.

* pack.c (pack_pack): add templates 'q' and 'Q'.

* pack.c (pack_unpack): ditto.

* bignum.c (rb_quad_pack): new utility function.

* bignum.c (rb_quad_unpack): ditto.

* parse.y (assignable): should emit CVASGN within the method
  body.

* dir.c (dir_s_glob): should not warn even if no match found.

* eval.c (rb_eval): clean up class variable behavior.

* eval.c (assign): ditto.

* eval.c (is_defined): ditto.

* variable.c (rb_mod_class_variables): need not to call rb_cvar_singleton().

* variable.c (rb_cvar_singleton): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-13 09:01:11 +00:00
matz f547c1150c * class.c (rb_include_module): detect cyclic module inclusion.
* eval.c (rb_thread_cleanup): need not to free thread stacks at
  process termination.

* array.c (rb_ary_fetch): use the block to get the default value
  if the block is given.

* eval.c (rb_thread_schedule): should check time only if BOTH
  WAIT_SELECT and WAIT_TIME.

* eval.c (umethod_bind): should update rklass field.

* hash.c (rb_hash_update): if a block is given, yields [key,
  value1, value2] to the block to resolve conflict.

* string.c (rb_str_split_m): no need to consider KANJI
characters, if the length of separator is 1 (byte).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-25 08:22:11 +00:00
matz b03bdcd64f * eval.c (ruby_stop): should not trace error handler.
* signal.c (install_sighandler): do not install sighandler unless
  the old value is SIG_DFL.

* io.c (io_write): should not raise exception on O_NONBLOCK io.

* dir.c (dir_set_pos): seek should return dir, pos= should not.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-21 07:44:06 +00:00
matz a7a7324ea6 * io.c (rb_io_s_new): block check moved from initialize to this
method.

* io.c (rb_io_s_open): open should call initialize too. IO#for_fd
  also calls initialize. [new]

* error.c (rb_sys_fail): replace INT2FIX() by INT2NUM() since
  errno value may not fit in Fixnum size on Hurd.

* error.c (set_syserr): ditto.

* dir.c (dir_s_glob): returns nil if block given.

* io.c (rb_io_each_byte): should return self.

* io.c (rb_io_close_m): close check added.

* dir.c (dir_seek): should return pos.

* parse.y (fixpos): orig may be (NODE*)1, which should not be
  dereferenced.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-18 14:24:01 +00:00
matz dc98adf839 * process.c (security): always give warning for insecure PATH.
* dir.c (my_getcwd): do not rely on MAXPATHLEN.

* file.c (rb_file_s_readlink): ditto.

* file.c (path_check_1): ditto.

* eval.c (rb_yield_0): should not call rb_f_block_given_p().

* string.c (rb_str_chomp_bang): should terminate string by NUL.

* eval.c (rb_yield_0): better error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-08 06:43:14 +00:00
matz 1fe40b7cc5 * 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
2001-10-03 07:19:19 +00:00
matz 6767cd760a * string.c (rb_str_init): String.new() => ""
* dir.c (dir_path): new method.

* dir.c (dir_initialize): wrap DIR into struct, along with path
  information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-19 06:54:11 +00:00
matz 67245eec71 * eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore.

* eval.c (rb_thread_save_context): restore lastline and lastmatch.

* numeric.c (flo_to_s): should handle negative float value.

* class.c (rb_include_module): should check whole ancestors to
  avoid duplicate module inclusion.

* string.c (trnext): should check backslash before updating "now"
  position.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-08 14:17:53 +00:00
nobu aebf069adf * dir.c (dir_s_chdir): raise if environment variable HOME/LOGDIR
not set.

* dir.c (glob_helper): avoid infinite loop on a file name with
  wildcard characters. (ruby-bugs#PR177)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-06 08:48:07 +00:00
matz 03d1c9cd82 * regex.c (re_search): should consider reverse search.
* dir.c (dir_s_chdir): warn only when invoked from multiple
  threads or block is not given.

* object.c (rb_convert_type): should use rb_rescue(), not rb_rescue2().

* range.c (range_init): ditto.

* object.c (rb_obj_dup): should free generic_ivar if original owns
  them.

* string.c (rb_str_each_line): should propagate taint mark.

* ext/nkf/nkf.c (rb_nkf_kconv): ditto.

* eval.c (rb_f_require): revamp for simpler implementation.

* file.c (rb_find_file_noext): use String object, instead of
  passing char* around.

* file.c (rb_find_file): ditto.

* dln.c (dln_load): should use NSLINKMODULE_OPTION_BINDNOW.

* ruby.c (load_file): local variables 'c' remain uninitialized on
  xflag.

* regex.c (re_match): prefetched escaped character too early.

* eval.c (rb_call0): add argument check for attr_readers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-14 15:17:19 +00:00
matz ffe1cf575e * error.c (exc_exception): clone the receiver exception instead of
creating brand new exception object of the receiver.

* eval.c (rb_eval_string_wrap): extend new ruby_top_self, not
  original self.

* eval.c (rb_eval_cmd): respect ruby_wrapper if set.

* eval.c (eval): do not update ruby_class unless scope is not
  provided.

* eval.c (eval): preserve wrapper information.

* eval.c (proc_invoke): ditto.

* eval.c (block_pass): ditto.

* parse.y (void_expr): too much warnings for void context
  (e.g. foo[1] that can be mere Proc call).

* error.c (rb_name_error): new function to raise NameError with
  name attribute set.

* eval.c (rb_f_missing): set name and args in the exception
  object. [new]

* error.c (name_name): NameError#name - new method.

* error.c (nometh_args): NoMethodError#args - new method.

* lex.c (rb_reserved_word): lex_state after tRESCUE should be
  EXPR_MID.

* gc.c (add_heap): allocation size of the heap unit is doubled for
  each allocation.

* dir.c (isdelim): space, tab, and newline are no longer
  delimiters for glob patterns.

* eval.c (svalue_to_avalue): new conversion scheme between single
  value and array values.

* eval.c (avalue_to_svalue): ditto.

* eval.c (rb_eval): REXPAND now uses avalue_to_svalue(), return
  and yield too.

* eval.c (rb_yield_0): use avalue_to_svalue().

* eval.c (proc_invoke): Proc#call gives avaules, whereas
  Proc#yield gives mvalues.

* eval.c (bmcall): convert given value (svalue) to avalue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-02 08:46:28 +00:00
knu 6aa71d4c80 * dir.c (Init_Dir): add a new method File::fnmatch? along with
File::Constants::FNM_*.  While I am here, FNM_NOCASE is renamed
  to FNM_CASEFOLD which is commonly used by *BSD and GNU libc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-06-13 10:51:39 +00:00
knu 4407373ef1 * dir.c (glob_helper): teach has_magic() to handle flags and get
glob_helper to properly support FNM_NOESCAPE.

* dir.c (fnmatch): fix a bug when FNM_PATHNAME and FNM_PERIOD are
  specified at the same time.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-27 17:24:24 +00:00
matz f84f4aa6b3 * array.c (rb_ary_and): should not push frozen key string.
* array.c (rb_ary_or): ditto.

* eval.c (rb_thread_schedule): should save context before raising
  deadlock, saved context for current thread might be obsolete.

* time.c (make_time_t): non DST timezone shift supported (hopefully).

* time.c (make_time_t): strict range detection for negative time_t.

* signal.c: SIGINFO added.

* eval.c (rb_ensure): should not SEGV when prot_tag is NULL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-16 09:05:54 +00:00
matz cc043890f8 * bignum.c (bigdivrem): access boundary bug.
* marshal.c (w_object): prohibit dumping out singleton classes.

* object.c (rb_mod_to_s): distinguish singleton classes.

* variable.c (rb_class2name): it's ok to reveal NilClass,
  TrueClass, FalseClass.

* eval.c (rb_yield_0): preserve and restore ruby_cref as well.

* eval.c (is_defined): core dumped during instance_eval for
  special constants.

* eval.c (rb_eval): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-11 05:24:59 +00:00
matz 1d3d27b42d forgot some checkins.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-06 15:06:00 +00:00
eban e28a9a7b94 * dir.c (rb_glob, rb_globi): remove unnecessary FNM_PATHNAME.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-02 12:07:30 +00:00
matz fd06a2a7fb * eval.c (block_pass): should not downgrade safe level.
* ext/dbm/extconf.rb: allow specifying dbm-type explicitly.

* ext/dbm/extconf.rb: avoid gdbm if possible, because it leaks
  memory, whereas gdbm.so doesn't.  potential incompatibility.

* string.c (rb_str_insert): new method.

* parse.y (yylex): lex_state after RESCUE_MOD should be EXPR_BEG.

* array.c (rb_ary_insert): new method.

* array.c (rb_ary_update): new utility function.

* io.c (set_outfile): should check if closed before assignment.

* eval.c (rb_eval): should preserve value of ruby_errinfo.

* eval.c (rb_thread_schedule): infinite sleep should not cause
  dead lock.

* array.c (rb_ary_flatten_bang): proper recursive detection.

* eval.c (yield_under): need not to prohibit at safe level 4.

* pack.c (pack_pack): p/P packs nil into NULL.

* pack.c (pack_unpack): p/P unpacks NULL into nil.

* pack.c (pack_pack): size check for P template.

* ruby.c (set_arg0): wrong predicate when new $0 value is bigger
  than original space.

* gc.c (id2ref): should use NUM2ULONG()

* object.c (rb_mod_const_get): check whether name is a class
  variable name.

* object.c (rb_mod_const_set): ditto.

* object.c (rb_mod_const_defined): ditto.

* marshal.c (w_float): precision changed to "%.16g"

* eval.c (rb_call0): wrong retry behavior.

* numeric.c (fix_aref): a bug on long>int architecture.

* eval.c (rb_eval_string_wrap): should restore ruby_wrapper.

* regex.c (re_compile_pattern): char class at either edge of range
  should be invalid.

* eval.c (handle_rescue): use === to compare exception match.

* error.c (syserr_eqq): comparison between SytemCallErrors should
  based on their error numbers.

* eval.c (safe_getter): should use INT2NUM().

* bignum.c (rb_big2long): 2**31 cannot fit in 31 bit long.

* regex.c (calculate_must_string): wrong length calculation.

* eval.c (rb_thread_start_0): fixed memory leak.

* parse.y (none): should clear cmdarg_stack too.

* io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on
  some platforms.

* file.c (rb_stat_dev): device functions should honor stat field
  types (except long long such as dev_t).

* eval.c (rb_mod_nesting): should not push nil for nesting array.

* eval.c (rb_mod_s_constants): should not search array by
  rb_mod_const_at() for nil (happens for singleton class).

* class.c (rb_singleton_class_attached): should modify iv_tbl by
  itself, no longer use rb_iv_set() to avoid freeze check error.

* variable.c (rb_const_get): error message "uninitialized constant
  Foo at Bar::Baz" instead of "uninitialized constantBar::Baz::Foo".

* eval.c (rb_mod_included): new hook called from rb_mod_include().

* io.c (opt_i_set): should strdup() inplace_edit string.

* eval.c (exec_under): need to push cref too.

* eval.c (rb_f_missing): raise NameError for "undefined local
  variable or method".

* error.c (Init_Exception): new exception NoMethodError.
  NameError moved under ScriptError again.

* eval.c (rb_f_missing): use NoMethodError instead of NameError.

* file.c (Init_File): should redifine "new" class method.

* eval.c (PUSH_CREF): sharing cref node was problematic.  maintain
  runtime cref list instead.

* eval.c (rb_eval): copy defn node before registering.

* eval.c (rb_load): clear ruby_cref before loading.

* variable.c (rb_const_get): no recursion to show full class path
  for modules.

* eval.c (rb_set_safe_level): should set safe level in curr_thread
  as well.

* eval.c (safe_setter): ditto.

* object.c (rb_obj_is_instance_of): nil belongs to false, not true.

* time.c (make_time_t): proper (I hope) daylight saving time
  handling for both US and Europe.  I HATE DST!

* eval.c (rb_thread_wait_for): non blocked signal interrupt should
  stop the interval.

* eval.c (proc_eq): class check aded.

* eval.c (proc_eq): typo fixed ("return" was ommitted).

* error.c (Init_Exception): move NameError under StandardError.

* class.c (rb_mod_clone): should copy method bodies too.

* bignum.c (bigdivrem): should trim trailing zero bdigits of
  remainder, even if dd == 0.

* file.c (check3rdbyte): safe string check moved here.

* time.c (make_time_t): remove HAVE_TM_ZONE code since it
  sometimes reports wrong time.

* time.c (make_time_t): remove unnecessary range check for
  platforms where negative time_t is available.

* process.c (proc_waitall): should push Process::Status instead of
  Finuxm status.

* process.c (waitall_each): should add all entries in pid_tbl.
  these changes are inspired by Koji Arai.  Thanks.

* process.c (proc_wait): should not iterate if pid_tbl is 0.

* process.c (proc_waitall): ditto.

* numeric.c (flodivmod): a bug in no fmod case.

* process.c (pst_wifsignaled): should apply WIFSIGNALED for status
  (int), not st (VALUE).

* io.c (Init_IO): value of $/ and $\ are no longer restricted to
  strings.  type checks are done on demand.

* class.c (rb_include_module): module inclusion should be check
  taints.

* ruby.h (STR2CSTR): replace to StringType() and StringTypePtr().

* ruby.h (rb_str2cstr): ditto.

* eval.c (rb_load): should not copy topleve local variables.  It
  cause variable/method ambiguity.  Thanks to L. Peter Deutsch.

* class.c (rb_include_module): freeze check at first.

* eval.c (rb_attr): sprintf() and rb_intern() moved into
  conditional body.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-02 04:22:21 +00:00
eban 2ed9c79bbb * win32/win32.c: use ruby's opendir on mingw32.
* win32/dir.h, dir.c, Makefile: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-04-01 16:22:13 +00:00