diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-22 01:40:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-22 01:40:40 +0000 |
commit | 6c801fc58f39085ea5e71fc9b07e4fa52427b5e5 (patch) | |
tree | cd2b6c3543efa3b64c076a9886e61b03d7cfdd85 /vsnprintf.c | |
parent | c5d781dded856a86609ebd9fd4904c3e9f3474fd (diff) |
sprintf.c: ruby specific functions
* sprintf.c (ruby_vsnprintf, ruby_snprintf): move ruby specific
functions from vsnprintf.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vsnprintf.c')
-rw-r--r-- | vsnprintf.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/vsnprintf.c b/vsnprintf.c index 76178fed5e..49431d1640 100644 --- a/vsnprintf.c +++ b/vsnprintf.c @@ -1311,43 +1311,3 @@ exponent(char *p0, int exp, int fmtch) return (int)(p - p0); } #endif /* FLOATING_POINT */ - -int -ruby_vsnprintf(char *str, size_t n, const char *fmt, va_list ap) -{ - int ret; - FILE f; - - if ((int)n < 1) - return (EOF); - f._flags = __SWR | __SSTR; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._w = n - 1; - f.vwrite = BSD__sfvwrite; - f.vextra = 0; - ret = (int)BSD_vfprintf(&f, fmt, ap); - *f._p = 0; - return (ret); -} - -int -ruby_snprintf(char *str, size_t n, char const *fmt, ...) -{ - int ret; - va_list ap; - FILE f; - - if ((int)n < 1) - return (EOF); - - va_start(ap, fmt); - f._flags = __SWR | __SSTR; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._w = n - 1; - f.vwrite = BSD__sfvwrite; - f.vextra = 0; - ret = (int)BSD_vfprintf(&f, fmt, ap); - *f._p = 0; - va_end(ap); - return (ret); -} |