Improve assertions.

This commit is contained in:
Mike Pall
2020-06-13 00:52:54 +02:00
parent 8b55054473
commit 8ae5170cdc
71 changed files with 1363 additions and 927 deletions

View File

@@ -320,7 +320,7 @@ SBuf *lj_strfmt_putfxint(SBuf *sb, SFormat sf, uint64_t k)
if ((sf & STRFMT_F_LEFT))
while (width-- > pprec) *p++ = ' ';
lua_assert(need == (MSize)(p - ps));
lj_assertX(need == (MSize)(p - ps), "miscalculated format size");
setsbufP(sb, p);
return sb;
}
@@ -449,7 +449,7 @@ const char *lj_strfmt_pushvf(lua_State *L, const char *fmt, va_list argp)
case STRFMT_ERR:
default:
lj_buf_putb(sb, '?');
lua_assert(0);
lj_assertL(0, "bad string format near offset %d", fs.len);
break;
}
}