mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Add common helper for pointer to string formatting.
This commit is contained in:
parent
517500ba48
commit
19c2dd17db
@ -714,8 +714,7 @@ again:
|
|||||||
lj_strfmt_putfchar(sb, sf, lj_lib_checkint(L, arg));
|
lj_strfmt_putfchar(sb, sf, lj_lib_checkint(L, arg));
|
||||||
break;
|
break;
|
||||||
case STRFMT_PTR: /* No formatting. */
|
case STRFMT_PTR: /* No formatting. */
|
||||||
setsbufP(sb, lj_strfmt_wptr(lj_buf_more(sb, STRFMT_MAXBUF_PTR),
|
lj_strfmt_putptr(sb, lj_obj_ptr(L->base+arg-1));
|
||||||
lj_obj_ptr(L->base+arg-1)));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lua_assert(0);
|
lua_assert(0);
|
||||||
|
@ -203,6 +203,12 @@ SBuf * LJ_FASTCALL lj_strfmt_putnum(SBuf *sb, cTValue *o)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SBuf * LJ_FASTCALL lj_strfmt_putptr(SBuf *sb, const void *v)
|
||||||
|
{
|
||||||
|
setsbufP(sb, lj_strfmt_wptr(lj_buf_more(sb, STRFMT_MAXBUF_PTR), v));
|
||||||
|
return sb;
|
||||||
|
}
|
||||||
|
|
||||||
/* Add quoted string to buffer. */
|
/* Add quoted string to buffer. */
|
||||||
SBuf * LJ_FASTCALL lj_strfmt_putquoted(SBuf *sb, GCstr *str)
|
SBuf * LJ_FASTCALL lj_strfmt_putquoted(SBuf *sb, GCstr *str)
|
||||||
{
|
{
|
||||||
@ -520,8 +526,7 @@ const char *lj_strfmt_pushvf(lua_State *L, const char *fmt, va_list argp)
|
|||||||
lj_buf_putb(sb, va_arg(argp, int));
|
lj_buf_putb(sb, va_arg(argp, int));
|
||||||
break;
|
break;
|
||||||
case STRFMT_PTR:
|
case STRFMT_PTR:
|
||||||
setsbufP(sb, lj_strfmt_wptr(lj_buf_more(sb, STRFMT_MAXBUF_PTR),
|
lj_strfmt_putptr(sb, va_arg(argp, void *));
|
||||||
va_arg(argp, void *)));
|
|
||||||
break;
|
break;
|
||||||
case STRFMT_ERR:
|
case STRFMT_ERR:
|
||||||
default:
|
default:
|
||||||
|
@ -93,6 +93,7 @@ LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putint(SBuf *sb, int32_t k);
|
|||||||
#if LJ_HASJIT
|
#if LJ_HASJIT
|
||||||
LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putnum(SBuf *sb, cTValue *o);
|
LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putnum(SBuf *sb, cTValue *o);
|
||||||
#endif
|
#endif
|
||||||
|
LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putptr(SBuf *sb, const void *v);
|
||||||
LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putquoted(SBuf *sb, GCstr *str);
|
LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putquoted(SBuf *sb, GCstr *str);
|
||||||
|
|
||||||
/* Formatted conversions to buffer. */
|
/* Formatted conversions to buffer. */
|
||||||
|
Loading…
Reference in New Issue
Block a user