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));
|
||||
break;
|
||||
case STRFMT_PTR: /* No formatting. */
|
||||
setsbufP(sb, lj_strfmt_wptr(lj_buf_more(sb, STRFMT_MAXBUF_PTR),
|
||||
lj_obj_ptr(L->base+arg-1)));
|
||||
lj_strfmt_putptr(sb, lj_obj_ptr(L->base+arg-1));
|
||||
break;
|
||||
default:
|
||||
lua_assert(0);
|
||||
|
@ -203,6 +203,12 @@ SBuf * LJ_FASTCALL lj_strfmt_putnum(SBuf *sb, cTValue *o)
|
||||
}
|
||||
#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. */
|
||||
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));
|
||||
break;
|
||||
case STRFMT_PTR:
|
||||
setsbufP(sb, lj_strfmt_wptr(lj_buf_more(sb, STRFMT_MAXBUF_PTR),
|
||||
va_arg(argp, void *)));
|
||||
lj_strfmt_putptr(sb, va_arg(argp, void *));
|
||||
break;
|
||||
case STRFMT_ERR:
|
||||
default:
|
||||
|
@ -93,6 +93,7 @@ LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putint(SBuf *sb, int32_t k);
|
||||
#if LJ_HASJIT
|
||||
LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putnum(SBuf *sb, cTValue *o);
|
||||
#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);
|
||||
|
||||
/* Formatted conversions to buffer. */
|
||||
|
Loading…
Reference in New Issue
Block a user