1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2012-05-24 16:15:42 +00:00
parent 8996556b05
commit 80aaa3ef6c
4 changed files with 20 additions and 7 deletions

View file

@ -183,7 +183,7 @@ typedef struct __sFILE {
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
size_t _lbfsize; /* 0 or -_bf._size, for inline putc */
int (*vwrite)(/* struct __sFILE*, struct __suio * */);
char *(*vextra)(/* struct __sFILE*, size_t, void*, long* */);
char *(*vextra)(/* struct __sFILE*, size_t, void*, long*, int */);
} FILE;
@ -811,11 +811,12 @@ reswitch: switch (ch) {
FLUSH();
#if defined _HAVE_SANE_QUAD_ && SIZEOF_VOIDP == SIZEOF_LONG_LONG
uqval = va_arg(ap, u_quad_t);
cp = (*fp->vextra)(fp, sizeof(uqval), &uqval, &fieldsz);
cp = (*fp->vextra)(fp, sizeof(uqval), &uqval, &fieldsz, sign);
#else
ulval = va_arg(ap, u_long);
cp = (*fp->vextra)(fp, sizeof(ulval), &ulval, &fieldsz);
cp = (*fp->vextra)(fp, sizeof(ulval), &ulval, &fieldsz, sign);
#endif
sign = '\0';
if (!cp) goto error;
if (prec < 0) goto long_len;
size = fieldsz < prec ? (int)fieldsz : prec;