summaryrefslogtreecommitdiff
path: root/sprintf.c
AgeCommit message (Collapse)Author
2014-06-02encoding.h: constify rb_encodingnobu
* include/ruby/encoding.h: constify `rb_encoding` itself, not only arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01constify rb_encoding and OnigEncodingnobu
* include/ruby/encoding.h: constify `rb_encoding` arguments. * include/ruby/oniguruma.h: constify `OnigEncoding` arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* parse.y: support Symbol GC. [ruby-trunk Feature #9634]nari
See this ticket about Symbol GC. * include/ruby/ruby.h: Declare few functions. * rb_sym2id: almost same as old SYM2ID but support dynamic symbols. * rb_id2sym: almost same as old ID2SYM but support dynamic symbols. * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not pin down a dynamic symbol. Declare a new struct. * struct RSymbol: represents a dynamic symbol as object in Ruby's heaps. Add few macros. * STATIC_SYM_P: check a static symbol. * DYNAMIC_SYM_P: check a dynamic symbol. * RSYMBOL: cast to RSymbol * gc.c: declare RSymbol. support T_SYMBOL. * internal.h: Declare few functions. * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this function at a sweep phase. * rb_str_dynamic_intern: convert a string to a dynamic symbol. * rb_check_id_without_pindown: not pinning function. * rb_sym2id_without_pindown: ditto. * rb_check_id_cstr_without_pindown: ditto. * string.c (Init_String): String#intern and String#to_sym use rb_str_dynamic_intern. * template/id.h.tmpl: use LSB of ID as a flag for determining a static symbol, so we shift left other ruby_id_types. * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to avoid pinning. * load.c: use xx_without_pindown function at creating temporary ID to avoid pinning. * object.c: ditto. * sprintf.c: ditto. * struct.c: ditto. * thread.c: ditto. * variable.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15* internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.akr
(BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS. (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX. (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT. (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN. (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN. (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P. (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P. (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG. (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK. (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT. (BIGNUM_LEN): Renamed from RBIGNUM_LEN. (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS. (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT. * bignum.c: Follow the above change. * gc.c: Ditto. * marshal.c: Ditto. * math.c: Ditto. * numeric.c: Ditto. * random.c: Ditto. * rational.c: Ditto. * sprintf.c: Ditto. * ext/-test-/bignum/bigzero.c: Ditto. * ext/-test-/bignum/intpack.c: Ditto. * ext/bigdecimal/bigdecimal.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-30sprintf.c: QUOTE flagnobu
* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11* sprintf.c: Fix typo patch by @hynkle [Fixes GH-357]zzak
https://github.com/ruby/ruby/pull/357 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* internal.h (INTEGER_PACK_2COMP): Defined.akr
(rb_integer_pack_2comp): Removed. * bignum.c (bary_pack): Support INTEGER_PACK_2COMP. (rb_integer_pack): Invoke bary_pack directly. (rb_integer_pack_2comp): Removed. (rb_integer_pack_internal): Ditto. (absint_numwords_generic): Follow the above change. * pack.c (pack_pack): Ditto. * sprintf.c (rb_str_format): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* sprintf.c (rb_str_format): Fix a dynamic format string.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (rb_integer_pack_internal): Renamed from rb_integer_packakr
and overflow_2comp argument added. (rb_integer_pack): Just call rb_integer_pack_internal. (rb_integer_pack_2comp): New function. * internal.h (rb_integer_pack_2comp): Declared. * sprintf.c (rb_str_format): Use rb_integer_pack and rb_integer_pack_2comp to format binary/octal/hexadecimal integers. (ruby_digitmap): Declared. (remove_sign_bits): Removed. (BITSPERDIG): Ditto. (EXTENDSIGN): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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-04-09* internal.h (MUL_OVERFLOW_INT_P): New macro.akr
* sprintf.c (GETNUM): Don't overflow on signed integer multiplication. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15sprintf.c: infectnobu
* sprintf.c (ruby__sfvextra): the result should be infected by the given strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15sprintf.c: coderange fixnobu
* sprintf.c (ruby__sfvwrite): set buffer length and exclude uninitialized garbage to get correct coderange. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-26use rb_check_hash_typenobu
* 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-05-24sprintf.c: inspect by plusnobu
* 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-24Feature #5896nobu
* 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-04-11* parse.y (rb_check_id_cstr): new function to check if ID isnobu
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* sprintf.c (rb_str_format): fix exception message encoding.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11* sprintf.c (rb_str_format): fix error message.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-10rb_str_format: check overflownobu
* 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-01-14* sprintf.c (rb_enc_vsprintf): relaxed the restriction. since thenobu
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-13* sprintf.c (rb_enc_vsprintf): can be used for ASCII compatiblenobu
encodings only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-22* sprintf.c (rb_str_format): add RB_GC_GUARD to prevent temporarynagachika
strings from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-25* random.c (random_rand): remove unused variables.naruse
* 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
2010-12-30* sprintf.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10* sprintf.c (_HAVE_SANE_QUAD_): Don't forget LP64, r30156.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10* sprintf.c (_HAVE_SANE_QUAD_): if a certain platform has LONG_LONG inusa
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-10-15Revert "* sprintf.c (rb_str_format): fix: sprintf with hex format and"naruse
This reverts commit a160986d90cf90a86e01d60eddb04ffe0e584c36. Revert wrong commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15* sprintf.c (rb_str_format): fix: sprintf with hex format andnaruse
precision includes wrong dots. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-15* sprintf.c (rb_f_sprintf): fix rdoc. pointed out by Tomoyukinobu
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-14* string.c (rb_str_times): mentioned about Hash argument. a patchnobu
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-07-21* sprintf.c: add short documentation about named reference.naruse
[ruby-core:31294] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21* util.c (ruby_hdtoa): renamed from BSD__hdtoa.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17* array.c: Documentation: change => in call-seq to ->.marcandre
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-04-04* include/ruby/ruby.h: replace snprintf and vsnprintf bynaruse
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-01* sprintf.c (rb_str_format): support %a format. [ruby-dev:40650]naruse
* 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-02-08* io.c (rb_io_getline_fast): wrong calculation of new positionmatz
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
2009-09-23* sprintf.c: fixed type.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-13revert r24507. [ruby-dev:39073]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11* sprintf.c (rb_str_format): should preserve format encodingmatz
before raising CompatibilityError. [ruby-list:46274] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19* encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()matz
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-04-13* sprintf.c (rb_str_format): scan coderange incrementally.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-13* sprintf.c (rb_str_format): optimize previous commit.naruse
[ruby-list:45954] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-13* sprintf.c (rb_str_format): check encoding compatibility only onnaruse
real parts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-27* sprintf.c (rb_str_format): checks if named argument given twice.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-27* sprintf.c (GETNAMEARG): remembers named arg is used, to get ridnobu
of too many arguments warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17* dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,nobu
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-02-22stripped trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-02 * include/ruby/missing.h, sprintf.c: get rid of a warning of VC++.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-28* sprintf.c: not force to override snprintf/vsnprintf.nobu
[ruby-core:20824] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e