summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12* file.c (rb_file_s_truncate): use correct type. chsize takeskosaki
a long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12* configure.in: removes AC_CHECK_FUNC(ftruncate64).kosaki
* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating NUM2OFFT. * file.c (rb_file_truncate): use correct type. chsize() take a long. * include/ruby/ruby.h (NUM2OFFT): use a definition created by a configure script by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-09* file.c, ext/etc/etc.c, ext/socket/unixsocket.c,akr
ext/openssl/ossl.h, ext/openssl/openssl_missing.c: Use HAVE_AGGREGATE_MEMBER instead of HAVE_ST_MEMBER. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31documentation by @phiggins [GH fixes #263]hsbt
* file.c: Alias File #path and #to_path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-16* configure.in: check struct timeval exist or not.kosaki
* include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL properly. and don't include sys/time.h if struct timeval exist. * file.c: include sys/time.h explicitly. * random.c: ditto. * thread_pthread.c: ditto. * time.c: ditto. * ext/date/date_strftime.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15error.c: rb_sys_fail_path_innobu
* error.c (syserr_initialize): add optional function name. * error.c (rb_sys_fail_path_in): rename and move from file.c, and pass func_name to SystemCallError#initialize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15file.c: rb_sys_fail_path_with_funcnobu
* file.c (rb_sys_fail_path_with_func): share same function, and path may be nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14file.c: insert separatornobu
* file.c (rb_sys_fail_path0): insert separator between function name and path name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14configure.in, file.c: RUBY_FUNCTION_NAME_STRINGnobu
* configure.in (rb_cv_function_name_string): macro for function name string predefined identifier, __func__ in C99, or __FUNCTION__ in gcc. * file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14* file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC.naruse
__func__ is C99 feature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14* file.c (rb_sys_fail_path0): add to append the name of called functionnaruse
to ease debugging for example blow umask_spec failure. http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130309T010202Z.diff.html.gz * file.c (rb_sys_fail_path): use rb_sys_fail_path0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-01Suppress warning: uninitialized valuenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23* array.c: Document #<=> return values and formattingzzak
* bignum.c: ditto * file.c: ditto * object.c: ditto * numeric.c: ditto * rational.c: ditto * string.c: ditto * time.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* file.c (rb_group_member): added an error check. SUS says,kosaki
getgroups(small_value) may return EINVAL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* file.c (RB_MAX_GROUPS): moved tokosaki
* internal.h (RB_MAX_GROUPS): here. * file.c (rb_group_member): use RB_MAX_GROUPS instead of RUBY_GROUP_MAX. They are the same. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* file.c (access_internal): removed.kosaki
* file.c (rb_file_readable_real): use access() instead of access_internal(). * file.c (rb_file_writable_real): ditto. * file.c (rb_file_executable_real): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* file.c (eaccess): use access() when not using setuid nor setgid.kosaki
This is minor optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* file.c (rb_group_member): get rid of NGROUPS dependency.kosaki
[Bug #7886] [ruby-core:52537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-14* file.c (rb_file_flock): use rb_thread_wait_for() instead ofkosaki
rb_thread_polling(). When getting EAGAIN, we need to wait a while even if no multi threading. * thread.c (sleep_for_polling, rb_thread_polling) removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13* file.c (rb_file_join): check encoding compatibility before joiningusa
strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20* file.c (Init_File): null device definition uses rb_define_constkosaki
instead of rb_file_const. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20file.c: fix rdocnobu
* file.c (rb_file_s_extname): fix rdoc for an edge case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20* file.c (File.extname): Documentation for extname on dotfiles andzzak
files ending with a dot. Also, added example for this. [ruby-core:47852] [Bug #7112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20* io.c (Init_IO): removed all rb_file_const() into file.c.kosaki
* file.c (Init_File): replace with rb_file_const() with rb_define_const() because RDoc don't care rb_file_const. [Bug #5530] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20* file.c (File::NULL): Document File::NULL constantzzak
[ruby-core:49384] [Bug #7365] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05Fix compatibility of cached expanded load pathshirosaki
* file.c (rb_get_path_check_to_string): extract from rb_get_path_check(). We change the spec not to call to_path of String object. * file.c (rb_get_path_check_convert): extract from rb_get_path_check(). * file.c (rb_get_path_check): follow the above change. * file.c (rb_file_expand_path_fast): remove check_expand_path_args(). Instead we call it in load.c. * file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to reduce expand cost. * file.c (rb_find_file_safe): ditto. * internal.h (rb_get_expanded_load_path): add a declaration. * internal.h (rb_get_path_check_to_string, rb_get_path_check_convert): add declarations. * load.c (rb_construct_expanded_load_path): fix for compatibility. Same checks in rb_get_path_check() are added. We don't replace $LOAD_PATH and ensure that String object of $LOAD_PATH are frozen. We don't freeze non String object and expand it every times. We add arguments for expanding load path partially and checking if load path have relative paths or non String objects. * load.c (load_path_getcwd): get current working directory for checking if it's changed when getting load path. * load.c (rb_get_expanded_load_path): fix for rebuilding cache properly. We check if current working directory is changed and rebuild expanded load path cache. We expand paths which start with ~ (User HOME) and non String objects every times for compatibility. We make this accessible from other source files. * load.c (rb_feature_provided): call rb_get_path() since we changed rb_file_expand_path_fast() not to call it. * load.c (Init_load): initialize vm->load_path_check_cache. * vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC. * vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data to check load path cache validity. * test/ruby/test_require.rb (TestRequire): add tests for require compatibility related to cached expanded load path. [ruby-core:47970] [Bug #7158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16file.c: ASCII-compatiblenobu
* file.c (rb_file_join): need to check again after any conversion run. [ruby-core:48012] [Bug #7168] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16file.c: hide resultnobu
* file.c (rb_file_join): hide the result under construction until return. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16file.c: ASCII-compatiblenobu
* file.c (rb_file_join): check nul-byte only for strings, since FilePathStringValue() does it. [ruby-core:48012] [Bug #7168] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16file.c: ASCII-compatiblenobu
* file.c (rb_file_join): path names must be ASCII-compatible. [ruby-core:48012] [Bug #7168] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16file.c: check_path_encodingnobu
* file.c (check_path_encoding): new function to ensure path name encoding to be ASCII-compatible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12file.c: GC guardnobu
* file.c (realpath_rec): prevent link from GC while link_names refers the content. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12file.c: poisoned NULnobu
* file.c (rb_get_path_check): path name must not contain NUL bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-16file.c: reduce xmallocnobu
* file.c (rb_readlink): read symlink in the result string directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-05file.c: no longer used functionsnobu
* file.c (getcwdofdrv, append_fspath): no longer used except for cygwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-24Improve require/File.expand_path performance on Windowsluislavena
* configure.in (mingw): add shlwapi to the list of dependency libs for Windows. * win32/Makefile.sub (EXTSOLIBS): ditto. * internal.h: declare internal functions rb_w32_init_file, rb_file_expand_path_internal and rb_file_expand_path_fast. * file.c (Init_File): invoke Windows initialization rb_w32_init_file * win32/file.c (rb_file_load_path_internal): new function. Windows-specific implementation that replaces file_expand_path. [Bug #6836][ruby-core:46996] * win32/file.c (rb_w32_init_file): new function. Initialize codepage cache for faster conversion encodings lookup. * file.c (file_expand_path): rename to rb_file_expand_path_internal. Conditionally exclude from Windows. * file.c (rb_file_expand_path_fast): new function. delegates to rb_file_expand_path_internal without performing a hit to the filesystem. * file.c (file_expand_path_1): use rb_file_expand_path_internal without path expansion (used by require). * file.c (rb_find_file_ext_safe): ditto. * file.c (rb_find_file_safe): ditto. * load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast. * load.c (rb_feature_provided): ditto. * file.c (rb_file_expand_path): use rb_file_expand_path_internal with path expansion. * file.c (rb_file_absolute_path): ditto. * test/ruby/test_file_exhaustive.rb: new tests to exercise rb_file_expand_path_internal implementation and compliance with existing behaviors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23load.c: keep encoding of feature namenobu
* file.c (rb_find_file_ext_safe, rb_find_file_safe): default to US-ASCII for encdb and transdb. * load.c (search_required): keep encoding of feature name. set loading path to filesystem encoding. [Bug #6377][ruby-core:44750] * ruby.c (add_modules, require_libraries): assume default external encoding as well as ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09* win32/configure.bat, win32/setup.mak, win32/Makefile.sub: omit Win9xusa
support. remove --enable/disable-win95 option. * include/ruby/win32.h, file.c, win32/win32.c: ditto. * win32/README.win32: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-17documentation for Dir.exist?nobu
* dir.c (rb_file_directory_p): move documentation for Dir.exist? from file.c so that the proper description will be shown instead of the documentation of File.directory?. [ruby-core:45685] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14* file.c (rb_file_s_basename, rb_file_s_dirname): documentaion fix.usa
File.basename and File.dirname support File::ALT_SEPARATOR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05obj_init_copynobu
* object.c (rb_obj_init_copy): should check if trusted too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26file.c: fix for UNCnobu
* file.c (realpath_rec): UNC prefix does not end with path separator, so new separator is needed after it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17Imports Ruby's port to NativeClient (a.k.a NaCl).yugui
Patch by Google Inc. [ruby-core:45073]. * configure.in (RUBY_NACL): New M4 func to configure variables for NaCl. (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names of Pepper interface types. (BTESTRUBY): New variable to specify which ruby should be run on "make btest". NaCl can run the built binary by sel_ldr, but it need rbconfig.rb. So this variable is distinguished from $MINIRUBY. * thread_pthread.c: Disabled some features on NaCl. * io.c: ditto. * process.c: ditto. * signal.c: ditto. * file.c: ditto. * missing/flock.c: ditto. * nacl/pepper_main.c: An example implementation of Pepper application that embeds Ruby. * nacl/example.html: An example of web page that uses the Pepper application. * nacl/nacl-config.rb: Detects variants of NaCl SDK. * nacl/GNUmakefile.in: Makefile template for NaCl specific build process. * nacl/package.rb: script for packaging a NaCl-Ruby embedding application. * nacl/reate_nmf.rb: Wrapper script of create_nmf.py * dln.c (dln_load): Added a hack to call on NaCl. * util.c (ruby_getcwd): Path to the current directort is not available on NaCl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15* reduce UNREACHABLE.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14* variable.c (trace_ev): Removed "not reached" comment as this line isdrbrain
reached. * variable.c (rb_obj_remove_instance_variable): Replaced "not reached" comment with the UNREACHABLE macro. * variable.c (rb_mod_const_missing): ditto. * variable.c (rb_mod_remove_cvar): ditto. * enum.c (first_i): ditto. * string.c (rb_str_aref): ditto. * string.c (str_byte_aref): ditto. * string.c (rb_to_id): ditto. * io.c (rb_io_fmode_modestr): ditto. * io.c (rb_io_oflags_modestr): ditto. * pack.c (num2i32): ditto. * vm_eval.c (rb_method_missing): ditto. * vm_eval.c (rb_f_throw): ditto. * dir.c (dir_read): ditto. * win32/win32.c (child_result): ditto. * struct.c (rb_struct_getmember): ditto. * struct.c (rb_struct_set): ditto. * struct.c (rb_struct_aref_id): ditto. * eval.c (rb_f_raise): ditto. * process.c (rb_f_exit_bang): ditto. * process.c (rb_f_exit): ditto. * process.c (rb_f_abort): ditto. * ext/-test-/iter/break.c (iter_break_value): ditto. * ext/pty/pty.c (pty_check): ditto. * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto. * ext/readline/readline.c (rb_remove_history): ditto. * ext/stringio/stringio.c (strio_unimpl): ditto. * numeric.c (num_sadded): ditto. * numeric.c (num_init_copy): ditto. * numeric.c (rb_num2ll): ditto. * numeric.c (rb_num2ull): ditto. * vm_insnhelper.c (call_cfunc): ditto. * ruby.c (opt_W_getter): ditto. * bignum.c (rb_big_coerce): ditto. * file.c (rb_f_test): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-23* file.c (rb_file_s_basename): rb_enc_asciicompat() evaluates the argument ↵nobu
multiple times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e