mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby.h: add mark to PRIsVALUE
* include/ruby/ruby.h (PRIsVALUE), vsnprintf.c (BSD_vfprintf): add RUBY_PRI_VALUE_MARK to reduce danger of accidental conflict with plain "%i". binary incompatible with extension libraries using PRIsVALUE and built for 2.1 and earlier. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
95e83cb3f9
commit
a9f3eb75de
4 changed files with 28 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Nov 4 12:51:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (PRIsVALUE), vsnprintf.c (BSD_vfprintf): add
|
||||
RUBY_PRI_VALUE_MARK to reduce danger of accidental conflict with
|
||||
plain "%i". binary incompatible with extension libraries using
|
||||
PRIsVALUE and built for 2.1 and earlier. [EXPERIMENTAL]
|
||||
|
||||
Tue Nov 4 12:33:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||
|
||||
* object.c: fix document of Kernel#String by @suzukaze
|
||||
|
|
|
@ -123,20 +123,21 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
|
|||
#define PRI_64_PREFIX PRI_LL_PREFIX
|
||||
#endif
|
||||
|
||||
#define RUBY_PRI_VALUE_MARK "\v"
|
||||
#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
|
||||
#define PRIdVALUE PRIdPTR
|
||||
#define PRIoVALUE PRIoPTR
|
||||
#define PRIuVALUE PRIuPTR
|
||||
#define PRIxVALUE PRIxPTR
|
||||
#define PRIXVALUE PRIXPTR
|
||||
#define PRIsVALUE PRIiPTR
|
||||
#define PRIsVALUE PRIiPTR""RUBY_PRI_VALUE_MARK
|
||||
#else
|
||||
#define PRIdVALUE PRI_VALUE_PREFIX"d"
|
||||
#define PRIoVALUE PRI_VALUE_PREFIX"o"
|
||||
#define PRIuVALUE PRI_VALUE_PREFIX"u"
|
||||
#define PRIxVALUE PRI_VALUE_PREFIX"x"
|
||||
#define PRIXVALUE PRI_VALUE_PREFIX"X"
|
||||
#define PRIsVALUE PRI_VALUE_PREFIX"i"
|
||||
#define PRIsVALUE PRI_VALUE_PREFIX"i"RUBY_PRI_VALUE_MARK
|
||||
#endif
|
||||
#ifndef PRI_VALUE_PREFIX
|
||||
# define PRI_VALUE_PREFIX ""
|
||||
|
|
|
@ -1253,6 +1253,9 @@ fmt_setup(char *buf, size_t size, int c, int flags, int width, int prec)
|
|||
#define FLOATING_POINT 1
|
||||
#define BSD__dtoa ruby_dtoa
|
||||
#define BSD__hdtoa ruby_hdtoa
|
||||
#ifdef RUBY_PRI_VALUE_MARK
|
||||
# define PRI_EXTRA_MARK RUBY_PRI_VALUE_MARK
|
||||
#endif
|
||||
#include "vsnprintf.c"
|
||||
|
||||
typedef struct {
|
||||
|
|
16
vsnprintf.c
16
vsnprintf.c
|
@ -806,7 +806,21 @@ reswitch: switch (ch) {
|
|||
#else
|
||||
# define INTPTR_FLAG 0
|
||||
#endif
|
||||
if (fp->vextra && (flags & INTPTR_MASK) == INTPTR_FLAG) {
|
||||
#ifdef PRI_EXTRA_MARK
|
||||
# define PRI_EXTRA_MARK_LEN (sizeof(PRI_EXTRA_MARK)-1)
|
||||
# define IS_PRI_EXTRA_MARK(s) \
|
||||
(PRI_EXTRA_MARK_LEN < 1 || \
|
||||
(*(s) == PRI_EXTRA_MARK[0] && \
|
||||
(PRI_EXTRA_MARK_LEN == 1 || \
|
||||
strncmp((s)+1, PRI_EXTRA_MARK+1, \
|
||||
PRI_EXTRA_MARK_LEN-1) == 0)))
|
||||
#else
|
||||
# define PRI_EXTRA_MARK_LEN 0
|
||||
# define IS_PRI_EXTRA_MARK(s) 1
|
||||
#endif
|
||||
if (fp->vextra && (flags & INTPTR_MASK) == INTPTR_FLAG &&
|
||||
IS_PRI_EXTRA_MARK(fmt)) {
|
||||
fmt += PRI_EXTRA_MARK_LEN;
|
||||
FLUSH();
|
||||
#if defined _HAVE_SANE_QUAD_ && SIZEOF_VOIDP == SIZEOF_LONG_LONG
|
||||
uqval = va_arg(ap, u_quad_t);
|
||||
|
|
Loading…
Reference in a new issue