summaryrefslogtreecommitdiff
path: root/sprintf.c
Commit message (Collapse)AuthorAgeFilesLines
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-4/+4
|
* [Bug #18973] Promote US-ASCII to ASCII-8BIT when adding 8-bit charNobuyoshi Nakada2022-08-311-4/+9
|
* Extract `update_coderange` macroNobuyoshi Nakada2022-08-311-16/+14
| | | | Which restarts scanning the code range in unscanned part.
* Check the room including the space to fillNobuyoshi Nakada2022-08-211-7/+9
|
* [Bug #18958] format string must be ASCII compatibleNobuyoshi Nakada2022-08-201-0/+1
|
* [Bug #18956] Negative codepoints are invalid charactersNobuyoshi Nakada2022-08-201-2/+2
|
* [Bug #18955] format single character for `%c`Nobuyoshi Nakada2022-08-201-6/+5
|
* [Bug #18955] Check length of argument for `%c` in proper encodingNobuyoshi Nakada2022-08-201-2/+3
|
* Scan the code range of the last added portionNobuyoshi Nakada2022-08-191-2/+4
|
* Scan the code range of the formatted portionNobuyoshi Nakada2022-08-191-3/+11
|
* rb_str_resize: Only clear coderange on truncationJean Boussier2022-08-181-1/+4
| | | | | If we are expanding the string or only stripping extra capacity then coderange won't change, so clearing it is wasteful.
* Extract common code from `rb_enc_vsprintf` and `rb_str_vcatf`Nobuyoshi Nakada2022-08-171-33/+25
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-651/+651
| | | | [Misc #18891]
* Use C99-defined macros to classify a floating-point numberNobuyoshi Nakada2021-08-271-1/+1
|
* Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada2021-08-241-1/+1
| | | | [Feature #18051]
* Escape unprintable chars only, without surrounding quotesNobuyoshi Nakada2021-07-241-1/+1
|
* Sort out quad_t related macrosNobuyoshi Nakada2021-07-221-7/+5
|
* sprintf.c: Removed conflicting definitionNobuyoshi Nakada2020-09-281-4/+0
|
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* Make temporary lock string encoding freeNobuyoshi Nakada2020-02-121-1/+1
| | | | | As a temporary lock string is hidden, it can not have instance variables, including non-inlined encoding index.
* decouple internal.h headers卜部昌平2019-12-261-5/+15
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-5/+0
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* move docs around [ci skip]卜部昌平2019-08-291-261/+0
| | | | To properly generate documents.
* Add /* fall through */ commentsYusuke Endoh2019-07-141-0/+1
| | | | to suppress some Coverity Scan warnings
* sprintf.c: fix typostomar2018-04-221-1/+1
| | | | | | | * sprintf.c: [DOC] fix typo. Patch by Lazarus Lazaridis (iridakos). [Fix GH-1789] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* quote symbolsnobu2018-03-141-0/+6
| | | | | | | | * sprintf.c (ruby__sfvextra): quote symbols as identifiers. * string.c (rb_id_quote_unprintable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: overflow checknobu2018-02-091-3/+6
| | | | | | | * sprintf.c (ruby_do_vsnprintf): pathologically, get rid of negative value when the result length exceeds INT_MAX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: remove dependecy on ruby/encoding.hnobu2018-01-091-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c: KeyError#receiver and KeyError#keynobu2017-09-181-1/+1
| | | | | | | | | | | | | * error.c: new method KeyError#receiver and KeyError#key. [Feature #12063] * hash.c: make KeyError object with receiver and key. * sprintf.c: ditto. Author: ksss <co000ri@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: NULL as strnobu2017-09-091-6/+14
| | | | | | | * sprintf.c (ruby_vsnprintf, ruby_snprintf): allow NULL as str, just count the expected buffer size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* suppress warnings when RUBY_USE_SETJMPEXnobu2017-08-021-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Improve error messagekazu2017-07-311-1/+1
| | | | | | ref [Bug #13761] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: width too bignobu2017-07-231-0/+1
| | | | | | | * sprintf.c (rb_str_format): explicitly reject too big negative width, instead of an empty string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: remove redundant conditionnobu2017-05-261-2/+1
| | | | | | | * sprintf.c (rb_str_format): when `t + 1 == end` (or `t < end`), `*t == '%'` is always true. [ruby-core:80153] [Bug #13315] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Raise ArgumentError if sprintf format string ends with %eregon2017-05-251-1/+4
| | | | | | | | * Add tests and specs. See ruby/spec#401. Patch by Yuta Iwama and Shintaro Morikawa. [ruby-core:80153] [Bug #13315] [Fix GH-1560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: remove unused variablenobu2017-04-281-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: ruby_ultoanobu2017-04-281-5/+5
| | | | | | | * sprintf.c (ruby_ultoa): prefixed to get rid of conflict with a MSVC library function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: format by utility functionsnobu2017-04-281-38/+38
| | | | | | | | | | * sprintf.c (rb_str_format, fmt_setup): format by utility functions in vsnprintf.c instead of `snprintf`. * sprintf.c (rb_str_format): format and append by `rb_str_catf` instead of formatting by `snprintf` and then copy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: fix one-off bugnobu2017-04-281-5/+5
| | | | | | | * sprintf.c (rb_str_format): `CHECK` just before `FILL_`, but after another `PUSH`. fix one-off bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Refactor "%f" % Inf/NaNnobu2017-04-231-18/+17
| | | | | | | * sprintf.c (rb_str_format): as for non-finite float, calculate the exact needed size with the space flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix space flag when Inf/NaN and width==3nobu2017-04-231-3/+1
| | | | | | | | * sprintf.c (rb_str_format): while `"% 2f"` and `"% 4f"` result in `" Inf"` and `" Inf"` respectively, `"% 3f"` results in `"Inf"` (no space). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Avoid integer overflow in sprintf()nobu2017-03-201-1/+2
| | | | | | merged https://github.com/mruby/mruby/commit/ff03a9a61c62340cff62f8e0fdc1a1e8775b6f17 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: string limitsnobu2017-03-201-3/+8
| | | | | | | * sprintf.c (ruby__sfvwrite): use long instead of size_t due to string limits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: use FILLnobu2017-03-191-24/+13
| | | | | | | * sprintf.c (rb_str_format): use FILL and FILL_ macros instead of while loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: fix out-of-bound accessnobu2017-03-131-0/+1
| | | | | | | * sprintf.c (rb_str_format): get rid of out-of-bound access when single % at the end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert RB_FIXABLE related changesets [Bug #13288][Bug #13293][Bug #13294]shyouhei2017-03-091-1/+5
| | | | | | | | | This commit is auto-generated using following command: svn diff -r57807:57788 include internal.h bignum.c numeric.c compile.c insns.def object.c sprintf.c | patch -p0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optimize FIXABLE macroshyouhei2017-03-061-5/+1
| | | | | | | | | | | | Looking at the source code, FIXABLE tends to be just before LOING2FIX to check applicability of that operation. Why not try computing first then check for overflow, which should be optimial. I also tried the same thing for unsigned types but resulted in slower execution. It seems RB_POSFIXABLE() is fast enough on modern CPUs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sprintf.c: avoid garbage in common (no exception) casenormal2017-01-311-2/+4
| | | | | | | | | | | Format strings which are dynamically-generated will benefit from this. This won't cover exceptions, but exceptions for sprintf should be too uncommon to care about (unlike IO) * sprintf.c (rb_str_format): use rb_str_tmp_frozen_{acquire,release} * test/ruby/test_sprintf.rb (test_no_hidden_garbage): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e