merge revision(s) r46408,r46410,r46413,r46414,r46424,r46436,r46437: [Backport #9934]

	string.c: shrink too big buffer

	* string.c (rb_str_resize): shrink the buffer even if new length
  is same but it is enough smaller than the capacity.
	* file.c (expand_path): shrink expanded path which no longer needs
	  rooms to append.  [ruby-core:63114] [Bug #9934]

	* string.c (rb_str_resize): should consider the capacity instead
	  of the old length, as pointed out by nagachika.

	* string.c (rb_str_resize): update capa only when buffer get
	  reallocated.
	  http://d.hatena.ne.jp/nagachika/20140613/ruby_trunk_changes_46413_46420#r46413


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r46481: [Backport #9966]

	* encoding.c (enc_find): [DOC] never accepted a symbol.
	  [ruby-dev:48308] [Bug #9966]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge r46831 partially. extracted commits are as follows.
https://github.com/k-takata/Onigmo/commit/b9fba1dc63ccb42a86e934011b468e6022fabb74
https://github.com/k-takata/Onigmo/commit/c1fc76b9bd463948ffc5058bc352bf93732f0314
https://github.com/k-takata/Onigmo/commit/a0efc0a200f7108ca3d5ac3039c8f952e0051619
https://github.com/k-takata/Onigmo/commit/c7cda4ed5676167b0d01bb5555724f6164fbdb13
[Bug #8716]

* include/ruby/oniguruma.h (ONIG_MAX_CAPTURE_GROUP_NUM,
  ONIGERR_TOO_MANY_CAPTURE_GROUPS): add cheking the number of capture
  groups.

* regerror.c (onig_error_code_to_format): ditto.

* regparse.c (scan_env_add_mem_entry): ditto.

* regexec.c (onig_region_copy, match_at): fix: segmation fault occurs
  when many groups are used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45349,r45837,r45838: [Backport #9521] [Backport #9682]

	* lib/time.rb: [DOC] Fix timezone in example of Time.parse [Bug #9521]
	  Based on patch by @stomar

	* lib/time.rb (Time.parse): [DOC] Fix an example in the documentation.
	  Reported by Marcus Stollsteimer.
	  [ruby-core:60778] [Bug #9521] and [ruby-core:61718] [Bug #9682]

	* lib/time.rb (Time.parse): [DOC] Fix an example in the documentation
	  to use EST.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45542,r45543: [Backport #9717]

	* gc.c (mark_current_machine_context): Call SET_STACK_END.
	  This reverts a hunk of r40703 by ko1.
	  This fixes [ruby-dev:48098] [Bug #9717].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r46896,r46897,r46898: [Backport #10078]

	* string.c (rb_str_count): fix wrong single-byte optimization.
	  7bit ascii can be a trailing byte in Shift_JIS.
	  [ruby-dev:48442] [Bug #10078]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r47037: [Backport #10106]

	* vm_insnhelper.c (vm_call_method): unusable super class should cause
	  method missing when BasicObject is refined but not been using.
	  [ruby-core:64166] [Bug #10106]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r47090: [Backport #10114]

	* parse.y (parser_yyerror): preserve source code encoding in
	  syntax error messages.  [ruby-core:64228] [Bug #10114]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r47098: [Backport #10117]

	* parse.y (parser_yylex): fix invalid char in eval, should raise
	  an syntax error too, as well as directly coded.
	  [ruby-core:64243] [Bug #10117]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45503,r45504,r45508,r45509,r47275: [Backport #9692]

	* configure.in (ac_cv_func___builtin_setjmp): gcc 4.9 disallows a
	  variable as the second argument of __builtin_longjmp().
	  [ruby-core:61800] [Bug #9692]

	* configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp() in
	  clang 5.1 uses `void**`, not `jmp_buf`.  [Bug #9692]

	* configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp()
	  in Apple LLVM 5.1 (LLVM 3.4svn) uses `void**`, not `jmp_buf`.
	  [Bug #9692]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45512,r45513,r45515: [Backport #9698]

	configure.in: indent

	* configure.in (ac_cv_func___builtin_setjmp): adjust indent.
	* configure.in (ac_cv_func___builtin_setjmp): should not skip
	  flags restoration in RUBY_WERROR_FLAG by `break`.
	  [ruby-dev:48086] [Bug #9698]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45537: [Backport #9710]

	* configure.in: get rid of __builtin_setjmp/__builtin_longjmp on
	  x64-mingw, which causes SEGV with callcc.
	  [ruby-core:61887] [Bug #9710]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45885: [Backport #9818]

	* configure.in (RUBY_SETJMP_TYPE): check for setjmp type after
	  CCDLFLAGS is appended to CFLAGS, since __builtin_setjmp can be
	  affected.  [ruby-core:62469] [Bug #9818]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r46441: [Backport #9946]

	* process.c (open): use UTF-8 version function to support
	  non-ascii path properly.  [ruby-core:63185] [Bug #9946]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r47153: [Backport #10127]

	* ext/win32ole/win32ole.c (ole_create_dcom): use the converted
	  result if the argument can be converted to a string, to get rid
	  of invalid access. Thanks to nobu. [ruby-dev:48467] [Bug #10127]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r46387: [Backport #9607]

	* gc.c: change full GC timing to keep lower memory usage.
	  Extend heap only at
	  (1) after major GC
	  or
	  (2) after several (two times, at current) minor GC
	  Details in https://bugs.ruby-lang.org/issues/9607#note-9
	  [Bug #9607]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r45911,r45912,r45917,r45918,r45919: [Backport #9820]

	* signal.c (rb_f_kill): directly enqueue an ignored signal to self,
	  except for SIGSEGV and SIGBUS.  [ruby-dev:48203] [Bug #9820]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r46547: [Backport #9976]

	* hash.c (env_aset, env_has_key, env_assoc, env_has_value),
	  (env_rassoc, env_key): prohibit tainted strings if $SAFE is
	  non-zero.  [Bug #9976]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r47362: [Backport #9984]

	* test/openssl/test_pkey_rsa.rb (OpenSSL#test_sign_verify_memory_leak):
	  added timeout into testcase for low performance environment.
	  [Bug #9984][ruby-core:63367]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) r46569: [Backport #9982]

	* sprintf.c (GETASTER): should not use the numbered argument to be
	  formatted, raise ArgumentError instead.
	  [ruby-dev:48330] [Bug #9982]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e