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

108 Коммитов

Автор SHA1 Сообщение Дата
nobu 7271a56417 * util.c (BSD__hdtoa): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 21:59:57 +00:00
naruse 3a4c2bc034 * util.c (BSD__hdtoa): don't use C99 macros. (FP_NORMAL etc)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 05:09:10 +00:00
naruse 12b2e16e21 * sprintf.c (rb_str_format): support %a format. [ruby-dev:40650]
* missing/vsnprintf.c (BSD_vfprintf): ditto.

* missing/vsnprintf.c (cvt): ditto.

* util.c (BSD__hdtoa): added.  This is 2-clause BSDL licensed
  by David Schultz and from FreeBSD.

* LEGAL: add about hdtoa() in util.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 04:32:57 +00:00
naruse 4d399f12d4 * object.c (rb_cstr_to_dbl): return 0.0 if hexadecimal and
baccheck is FALSE: Float("0x1p+0") works, but "0x1p+0".to_f
  doesn't. [ruby-dev:40650]

* util.c (ruby_strtod): allow hexdecimal integers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 04:32:43 +00:00
naruse 9eb68d7c44 * util.c (ruby_strtod): Add support for Hexadecimal
floating-point expression [ruby-dev:40650] #2969

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-17 16:21:45 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
akr 145f07fac2 * util.c (ruby_strtod): use dval() consistently.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-10 23:23:15 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
nobu 8e86bd59c0 * common.mk (bignum.o, numeric.o): depend on util.h.
* bignum.c, marshal.c: fixed types.

* numeric.c (infinite_value): use ruby_div0.

* include/ruby/util.h (ruby_div0): moved from marshal.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 04:58:15 +00:00
nobu 22cde7b682 * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
  instead of strcpy, strncpy and sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
nobu 4de12b6ae9 * util.c (ruby_scan_oct, ruby_scan_hex): use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:25:20 +00:00
nobu 1f43321991 * util.c (ruby_each_words): assume no string exceeds INT_MAX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 08:54:21 +00:00
nobu 24ccacfafd * util.c (ruby_strdup, Balloc, rv_alloc): use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 05:16:03 +00:00
nobu 1f17d739ce * util.c (ruby_qsort): the result of cmp must be signed, so get
rid of reuse of a variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 04:53:13 +00:00
nobu 0164396029 * dln.c (init_funcname_len, dln_find_exe_r, dln_find_file_r): use
size_t.

* file.c (rb_stat_inspect, file_expand_path): ditto.

* util.c (ruby_qsort): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 01:56:15 +00:00
nobu 0f71c10acb * util.c (rv_strdup): macro to duplicate nul-terminated string.
[ruby-core:22852]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 23:06:51 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 2e54fe9d4d * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
nobu cbeec45612 * util.c (ruby_dtoa): allocates one more byte to get rid of buffer
overrun.  a patch from Charlie Savage at [ruby-core:22604].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-01 10:36:19 +00:00
akr f252633804 * util.c: fix SEGV by test_time.rb with
gcc version 4.4.0 20090219 (Red Hat 4.4.0-0.21) on Fedora 11 Alpha.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 13:05:30 +00:00
usa 5fb7052bb9 * util.c (valid_filename): use our own implementation of open(),
close() and unlink().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-26 04:31:21 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
usa 8563b285fb * util.c (rv_alloc, freedtoa): use our normal xmalloc()/xfree() because
couldn't free the returned pointer from ruby_dtoa().

	* missing/vsnprintf.c (cvt): receive buffer and use/return it instead
	  of returning the pointer returned from BSD__dtoa().

	* missing/vsnprintf.c (BSD_vfprintf): pass buf to cvt() as the buffer.
	  [ruby-core:22184]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-20 14:29:00 +00:00
nobu 860fad971d * thread.c (blocking_region_{begin,end}): declared as inline.
* util.c (freedtoa): used only when MULTIPLE_THREADS is not defined.

* win32/win32.c (rb_w32_pipe): serial is DWORD.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-26 09:01:23 +00:00
nobu d8267b72b5 * util.c (freedtoa): made static to get rid of name clash. a patch by
Tadashi Saito <shiba AT mail2.accsnet.ne.jp> at [ruby-dev:36913]

* util.c (ruby_dtoa): added prefix, ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24 18:56:31 +00:00
yugui ae7ea3332b * dln.c: Ruby no longer supports MS-DOS.
* ext/sdbm/_sdbm.c: ditto.

* ext/sdbm/sdbm.h: ditto.

* gc.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/util.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* util.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:33:22 +00:00
yugui 8dd118c0db * djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.
* djgpp/README.djgpp: ditto.

* djgpp/config.hin: ditto.

* djgpp/config.sed: ditto.

* djgpp/configure.bat: ditto.

* djgpp/mkver.sed: ditto.

* ext/Setup.dj: ditto.

* dln.c: removed djgpp supports.

* file.c: ditto.

* gc.c: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* util.c: ditto.

* vm_core.h: ditto.

* lib/fileutils.rb: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/socket.c: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:25:12 +00:00
nobu 076b6a226f * sprintf.c, util.c (quorem, nrv_alloc, dtoa): enabled floating point
support.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 07:06:33 +00:00
wanabe eff06d7ae6 * util.c (ruby_strtod): ruby_strtod don't allow a trailing
decimal point like "7.". [ruby-dev:34835] [ruby-dev:35009]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 08:01:09 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
nobu 0455e8ea9a * io.c (rb_f_open), re.c (rb_reg_search), transcode.c (str_transcode):
suppress warnings.

* util.c (quorem, rv_alloc, nrv_alloc): only used in dtoa().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-07 12:38:03 +00:00
mame eef10d71dd * st.c (st_reverse_foreach): comment out unused function.
* util.c (dtoa): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-05 12:47:48 +00:00
nobu 6a62b8e803 * util.c (ruby_strtod, dtoa): initialize more variables for error
handling.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 23:47:02 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
matz c2257734e3 * util.c (ruby_strtod): clear errno at the top of our own
impelementation of strtod(3).  [ruby-dev:34834] [ruby-dev:34839]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-26 07:51:46 +00:00
nobu 552badf29f * debug.c (ruby_set_debug_option): separated ruby_each_words().
* util.c (ruby_each_words): extracted from ruby_set_debug_option().

* ruby.c (proc_options): generalized enable/disable options.

* ruby.c (ruby_init_gems): take enabled flag.  [ruby-core:14840]

* ruby.c (process_options): added --disable-rubyopt flag.

* include/ruby/util.h (ruby_each_words): prototype.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-23 21:13:05 +00:00
nobu fe80dd73b9 * util.c (valid_filename): use O_EXCL to get rid of clobbering
existing files in race conditions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-23 18:53:00 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 9765389017 downcase MUL_OVERFLOW. it is a local variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 04:31:37 +00:00
akr 1db9577184 * util.c (ruby_strtoul): "0x", "+" and "-" is not a valid integer.
end of integer should be just after "0", the beginning, the
  beginning respectively.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 14:53:16 +00:00
akr 1642877c69 use signed char explicitly for table in scan_digits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 06:29:08 +00:00
akr 0352d32f05 * util.c (ruby_strtoul): locale independent strtoul is implemented to
avoid "i".to_i(36) cause 0 under tr_TR locale.
  This is newly implemented, not a copy of missing/strtoul.c.

* include/ruby/ruby.h (ruby_strtoul): declared.
  (STRTOUL): defined to use ruby_strtoul.

* bignum.c, pack.c, ext/socket/socket.c: use STRTOUL.

* configure.in (strtoul): don't check.

* missing/strtoul.c: removed.

* include/ruby/missing.h (strtoul): removed.

* common.mk (strtoul.o): removed.

* LEGAL (missing/strtoul.c): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 06:24:27 +00:00
nobu d4b9e9815b * util.c (IEEE_BIG_ENDIAN): use configured value. [ruby-dev:31623]
* util.c (Llong): set to LONG_LONG if available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-27 06:33:12 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
matz fb56832daf * util.c: updated for ANSI C only. applied a patch from
<snakagawa AT infoteria.co.jp>.  [ruby-dev:31591]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-22 15:08:09 +00:00
matz 40b5c7b26c * util.c (ruby_strtod): replaced by the implementation by David
M. Gay inspired by William D. Clinger's paper "How to Read Floating
  Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101].
  a patch from Satoshi Nakagawa <snakagawa AT infoteria.co.jp>.
  [ruby-dev:31582]

* test/ruby/test_float.rb (TestFloat::test_float): add test for
  precision.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21 20:57:48 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
nobu b338d1d6a4 * util.c (ruby_strtod): exponent is radix 10. [ruby-talk:248272]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-18 01:40:38 +00:00
matz 33163ad123 * regparse.c, etc.: K&R to ANSI code cleanup patch from Stefan
Huehner <stefan at huehner.org>.  [ruby-core:10543]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-19 03:58:57 +00:00
eban 35fadee53d * util.c (push_element): should return a int value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-04 05:51:07 +00:00