diff options
author | Mike Pall <mike> | 2011-06-07 21:10:04 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-06-07 21:10:04 +0200 |
commit | a0840d269546bc0b314dd2d0bcebe1785beb9f62 (patch) | |
tree | fc61adf68351631c8759e04e774b76b71f7ba333 | |
parent | a7ca722dca4b96367dff34402b21901f3e44a3cf (diff) | |
download | luajit-a0840d269546bc0b314dd2d0bcebe1785beb9f62.tar.gz luajit-a0840d269546bc0b314dd2d0bcebe1785beb9f62.tar.bz2 luajit-a0840d269546bc0b314dd2d0bcebe1785beb9f62.zip |
FFI: Print NULL pointers as "cdata<... *>: NULL".
-rw-r--r-- | src/lj_str.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_str.c b/src/lj_str.c index a5d894e0..cd3a8b69 100644 --- a/src/lj_str.c +++ b/src/lj_str.c | |||
@@ -360,6 +360,10 @@ const char *lj_str_pushvf(lua_State *L, const char *fmt, va_list argp) | |||
360 | char buf[2+FMTP_CHARS]; | 360 | char buf[2+FMTP_CHARS]; |
361 | ptrdiff_t p = (ptrdiff_t)(va_arg(argp, void *)); | 361 | ptrdiff_t p = (ptrdiff_t)(va_arg(argp, void *)); |
362 | ptrdiff_t i, lasti = 2+FMTP_CHARS; | 362 | ptrdiff_t i, lasti = 2+FMTP_CHARS; |
363 | if (p == 0) { | ||
364 | addstr(L, sb, "NULL", 4); | ||
365 | break; | ||
366 | } | ||
363 | #if LJ_64 | 367 | #if LJ_64 |
364 | /* Shorten output for 64 bit pointers. */ | 368 | /* Shorten output for 64 bit pointers. */ |
365 | lasti = 2+2*4+((p >> 32) ? 2+2*(lj_fls((uint32_t)(p >> 32))>>3) : 0); | 369 | lasti = 2+2*4+((p >> 32) ? 2+2*(lj_fls((uint32_t)(p >> 32))>>3) : 0); |