String buffers, part 2a: internal SBuf reorg. Use full pointers.

Sponsored by fmad.io.
This commit is contained in:
Mike Pall
2021-06-01 00:45:06 +02:00
parent b5dafe5891
commit 394fb6267a
24 changed files with 153 additions and 160 deletions

View File

@@ -38,15 +38,14 @@ LJLIB_CF(buffer_encode)
LJLIB_CF(buffer_decode)
{
GCstr *str = lj_lib_checkstr(L, 1);
const char *p = strdata(str);
char *p = (char *)strdata(str);
SBuf sb;
StrBuf sbuf;
setsbufL(&sb, L);
setmref(sb.b, p);
setmref(sb.p, p + str->len);
setmref(sb.e, p + str->len);
sb.b = p;
sb.w = sb.e = p + str->len;
sbuf.sb = &sb;
sbuf.r = (char *)p;
sbuf.r = p;
setnilV(L->top++);
lj_serialize_get(&sbuf, L->top-1);
lj_gc_check(L);