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

154 Коммитов

Автор SHA1 Сообщение Дата
nobu ffa20cf154 use rb_check_hash_type
* class.c (rb_scan_args): use rb_check_hash_type.
* process.c (rb_exec_getargs): ditto.
* sprintf.c (get_hash): ditto.
* string.c (rb_str_sub_bang, str_gsub): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-26 07:46:24 +00:00
nobu 80aaa3ef6c sprintf.c: inspect by plus
* sprintf.c (ruby__sfvextra): [EXPERIMENTAL] use inspect instead of
  to_s if plus flag is given.
* vsnprintf.c (BSD_vfprintf): pass sign flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 16:15:42 +00:00
nobu ce8e2d5404 Feature #5896
* vsnprintf.c (BSD_vfprintf): [EXPERIMENTAL] object representation in
  rb_enc_vsprintf(). [Feature #5896]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:36:54 +00:00
nobu db5265a82c * parse.y (rb_check_id_cstr): new function to check if ID is
registered with NUL-terminated C string.
* sprintf.c (rb_str_format): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11 13:31:23 +00:00
nobu a5d1da5d74 * sprintf.c (rb_str_format): fix exception message encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11 13:01:16 +00:00
nobu 23ba7541e5 * sprintf.c (rb_str_format): fix error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11 12:43:56 +00:00
nobu 99fd04b46f rb_str_format: check overflow
* sprintf.c (rb_str_format): check overflow at too long name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-10 07:26:35 +00:00
nobu c53470fd47 * sprintf.c (rb_enc_vsprintf): relaxed the restriction. since the
implementation deeply depends on plain char, so wchar_t based
  encodings are not supported.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-14 03:02:57 +00:00
nobu 23b4c10dd8 * sprintf.c (rb_enc_vsprintf): can be used for ASCII compatible
encodings only.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13 09:41:22 +00:00
nagachika 9c038691e1 * sprintf.c (rb_str_format): add RB_GC_GUARD to prevent temporary
strings from GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-22 14:48:10 +00:00
naruse 63f39fcb40 * random.c (random_rand): remove unused variables.
* struct.c (rb_struct_define_without_accessor): ditto.

* strftime.c (rb_strftime_with_timespec): ditto.

* sprintf.c: ditto.

* time.c (time_asctime): remove useless GetTimeval().

* thread_pthread.c: cast to (void *) for %p.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-25 07:56:42 +00:00
akr ae47a529f4 * sprintf.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-30 02:50:34 +00:00
naruse 9ea7e27d58 * sprintf.c (_HAVE_SANE_QUAD_): Don't forget LP64, r30156.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10 01:50:51 +00:00
usa 450680a5d7 * sprintf.c (_HAVE_SANE_QUAD_): if a certain platform has LONG_LONG in
8 byte, it might be sane quad. [ruby-core:33634]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10 01:41:02 +00:00
naruse 8a0cd16de1 Revert "* sprintf.c (rb_str_format): fix: sprintf with hex format and"
This reverts commit a160986d90.
Revert wrong commit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15 08:31:58 +00:00
naruse a160986d90 * sprintf.c (rb_str_format): fix: sprintf with hex format and
precision includes wrong dots.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15 08:28:12 +00:00
nobu 4f98aa2bcf * sprintf.c (rb_f_sprintf): fix rdoc. pointed out by Tomoyuki
Chikanaga at [ruby-core:32395], and a patch from Daniel
  Bovensiepen at [ruby-core:32403].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-15 23:30:46 +00:00
nobu 757f5bcb97 * string.c (rb_str_times): mentioned about Hash argument. a patch
from Daniel Bovensiepen at [ruby-core:32386].

* sprintf.c (get_hash): ditto, and fix typo.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-14 22:27:54 +00:00
naruse 6e2850aa46 * sprintf.c: add short documentation about named reference.
[ruby-core:31294]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21 06:16:07 +00:00
nobu 9a89e864ea * util.c (ruby_hdtoa): renamed from BSD__hdtoa.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21 02:55:10 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
naruse b919cb1d93 * include/ruby/ruby.h: replace snprintf and vsnprintf by
ruby_snprintf and ruby_vsnprintf. [ruby-dev:40909]

* configure.in: don't check snprintf(3) and vsnprintf(3).

* include/ruby/missing.h: don't delare snprintf and vsnprintf.

* include/ruby/ruby.h: include stdarg.h.

* sprintf.c: include vsnprintf.c

* vsnprintf.c: renamed from missing/vsnprintf.c.

* vsnprintf.c: remove useless ifdefs.

* win32/mkexports.rb: use ruby_snprintf and ruby_vsnprintf.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-04 01:10:53 +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
matz bba5e1126b * io.c (rb_io_getline_fast): wrong calculation of new position
from rb_str_coderange_scan_restartable().  [ruby-core:28103]

* io.c (read_all): ditto.  

* sprintf.c (rb_str_format): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-08 15:08:15 +00:00
nobu eb5692ab32 * sprintf.c: fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 04:17:16 +00:00
matz f7020b1b42 revert r24507. [ruby-dev:39073]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-13 03:03:20 +00:00
matz 5703c1756c * sprintf.c (rb_str_format): should preserve format encoding
before raising CompatibilityError.  [ruby-list:46274]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 23:53:21 +00:00
matz 91e5ba1cb8 * encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()
and rb_enc_codelen() in one function to reduce calls.

* encoding.c (rb_enc_codepoint): compatibility function.

* sprintf.c (rb_str_format): use rb_enc_codepoint_len().

* string.c (rb_str_inspect, rb_str_upcase_bang,
  rb_str_downcase_bang, rb_str_capitalize_bang,
  rb_str_swapcase_bang, trnext, tr_trans, rb_str_delete_bang,
  rb_str_squeeze_bang, rb_str_count, rb_str_split_m,
  rb_str_each_line, rb_str_each_codepoint, rb_str_lstrip_bang,
  sym_printable): ditto.

* transcode.c (make_econv_exception): use rb_enc_mbc_to_codepoint()

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19 16:59:22 +00:00
nobu 946fe69932 * sprintf.c (rb_str_format): scan coderange incrementally.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-13 08:21:41 +00:00
naruse b2ac99dfa3 * sprintf.c (rb_str_format): optimize previous commit.
[ruby-list:45954]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-13 02:40:20 +00:00
naruse 87335c3e2f * sprintf.c (rb_str_format): check encoding compatibility only on
real parts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-13 02:00:30 +00:00
nobu 48379c7309 * sprintf.c (rb_str_format): checks if named argument given twice.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-27 23:49:52 +00:00
nobu 456f68f2fd * sprintf.c (GETNAMEARG): remembers named arg is used, to get rid
of too many arguments warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-27 21:18:29 +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 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 7fc5fa69f1 * include/ruby/missing.h, sprintf.c: get rid of a warning of VC++.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 14:35:07 +00:00
nobu ca65828014 * sprintf.c: not force to override snprintf/vsnprintf.
[ruby-core:20824]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-28 09:40:04 +00:00
mame 41da4d16b0 * sprintf.c (rb_str_format): fix buffer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 15:18:12 +00:00
nobu 9f3b77e435 * configure.in (mingw): no longer uses snprintf and vsnprintf of
msvcrt.

* win32/win32.c (rb_w32_vsnprintf, rb_w32_snprintf): removed.

* win32/Makefile.sub (config.h): vsnprintf exists in VC7 or later.

* win32/mkexports.rb (Exports#initialize): aliases
  rb_w32_vsnprintf and rb_w32_snprintf for binary compatibility.

* sprintf.c (rb_str_format): uses snprintf instead of sprintf.

* numeric.c (flo_to_s, rb_num2long, rb_num2ll): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 03:05:20 +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
nobu 94355e2984 * sprintf.c (rb_str_format): check if codepoint for %c is valid.
[ruby-dev:36691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 18:41:35 +00:00
matz 8bfa0ac869 * sprintf.c (rb_str_format): add %<name>s style named argument
support.  a patch from Yusuke Endoh <mame at tsg.ne.jp>
  in [ruby-dev:35851].

* sprintf.c (rb_str_format): add gettext style named format
  (%{name}) support.  inspired by [ruby-dev:35852].

* sprintf.c (GETNAMEARG): should raise KeyError exception when no
  named argument found.

* hash.c (rb_hash_fetch): export fetch function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-30 08:01:11 +00:00
naruse d51b061565 * include/ruby/oniguruma.h (OnigCodePoint): unsigned long to unsigned int.
* include/ruby/encoding.h (rb_enc_codepoint): ditto.

* encoding.c (rb_enc_codepoint): signed int to unsigned int.

* encoding.c (rb_enc_ascget): ditto.

* string.c (rb_str_casecmp): ditto.

* string.c (enc_succ_alnum_char): ditto.

* string.c (rb_str_inspect): ditto.

* string.c (rb_str_upcase_bang): ditto.

* string.c (rb_str_downcase_bang): ditto.

* string.c (rb_str_capitalize_bang): ditto.

* string.c (rb_str_swapcase_bang): ditto.

* string.c (struct tr): ditto.

* string.c (trnext): ditto.

* string.c (tr_trans): ditto.

* string.c (tr_setup_table): ditto.

* string.c (tr_find): ditto.

* string.c (rb_str_delete_bang): ditto.

* string.c (rb_str_squeeze_bang): ditto.

* string.c (rb_str_count): ditto.

* string.c (rb_str_split_m): ditto.

* string.c (rb_str_each_line): ditto.

* string.c (rb_str_lstrip_bang): ditto.

* string.c (rb_str_rstrip_bang): ditto.

* string.c (rb_str_intern): ditto.

* dir.c (char_casecmp): ditto.

* sprintf.c (rb_str_format): ditto.

* enc/emacs_mule.c (mbc_to_code): to be 32bit clean.

* enc/emacs_mule.c (code_to_mbc): ditto.

* enc/gb18030.c (mbc_to_code): ditto.

* enc/gb18030.c (code_to_mbc): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-11 10:34:59 +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
nobu 70b317b9da * include/ruby/intern.h, sprintf.c (rb_str_catf, rb_str_vcatf): new
functions.  [ruby-dev:35597]

* string.c (rb_str_capacity): new function to return the capacity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22 07:48:00 +00:00
nobu 6ccce7e3f5 * missing/vsnprintf.c (struct __sbuf, FILE): use size_t.
* sprintf.c (ruby__sfvwrite): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-21 06:29:35 +00:00
mame 104e841390 * sprintf.c: include ieeefp.h to refer isinf.
* ext/bigdecimal/bigdecimal.c: ditto.

* ext/json/ext/generator/generator.c: ditto.

* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 16:24:11 +00:00
shyouhei 982450e24f * eval.c (rb_interrupt): trick to suppress GCC warning.
* sprintf.c (rb_str_format): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 11:59:50 +00:00
akr 3863e54bbf describe %% in rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 23:21:26 +00:00
akr 6aee0a5bca update sprintf rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 06:44:41 +00:00