diff options
author | Mike Pall <mike> | 2013-04-26 19:20:21 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-04-26 19:20:21 +0200 |
commit | a98e6a70c1692cf4e5686d0acee2ede54728af6f (patch) | |
tree | 1c6667a07167ea718152d908312f165e7720323d /src/lj_buf.h | |
parent | f9421f2b9f0959bc80eff064a0f13970c4e35cc1 (diff) | |
download | luajit-a98e6a70c1692cf4e5686d0acee2ede54728af6f.tar.gz luajit-a98e6a70c1692cf4e5686d0acee2ede54728af6f.tar.bz2 luajit-a98e6a70c1692cf4e5686d0acee2ede54728af6f.zip |
Abstract out some common buffer operations.
Diffstat (limited to 'src/lj_buf.h')
-rw-r--r-- | src/lj_buf.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lj_buf.h b/src/lj_buf.h index 98bcad20..92a6055a 100644 --- a/src/lj_buf.h +++ b/src/lj_buf.h | |||
@@ -36,6 +36,7 @@ LJ_FUNCA SBuf * LJ_FASTCALL lj_buf_putstr_reverse(SBuf *sb, GCstr *s); | |||
36 | LJ_FUNCA SBuf * LJ_FASTCALL lj_buf_putstr_lower(SBuf *sb, GCstr *s); | 36 | LJ_FUNCA SBuf * LJ_FASTCALL lj_buf_putstr_lower(SBuf *sb, GCstr *s); |
37 | LJ_FUNCA SBuf * LJ_FASTCALL lj_buf_putstr_upper(SBuf *sb, GCstr *s); | 37 | LJ_FUNCA SBuf * LJ_FASTCALL lj_buf_putstr_upper(SBuf *sb, GCstr *s); |
38 | LJ_FUNCA GCstr * LJ_FASTCALL lj_buf_tostr(SBuf *sb); | 38 | LJ_FUNCA GCstr * LJ_FASTCALL lj_buf_tostr(SBuf *sb); |
39 | LJ_FUNC GCstr *lj_buf_cat2str(lua_State *L, GCstr *s1, GCstr *s2); | ||
39 | LJ_FUNC uint32_t LJ_FASTCALL lj_buf_ruleb128(const char **pp); | 40 | LJ_FUNC uint32_t LJ_FASTCALL lj_buf_ruleb128(const char **pp); |
40 | LJ_FUNC char * LJ_FASTCALL lj_buf_wuleb128(char *p, uint32_t v); | 41 | LJ_FUNC char * LJ_FASTCALL lj_buf_wuleb128(char *p, uint32_t v); |
41 | 42 | ||
@@ -50,6 +51,14 @@ static LJ_AINLINE void lj_buf_reset(SBuf *sb) | |||
50 | setmrefr(sb->p, sb->b); | 51 | setmrefr(sb->p, sb->b); |
51 | } | 52 | } |
52 | 53 | ||
54 | static LJ_AINLINE SBuf *lj_buf_tmp_(lua_State *L) | ||
55 | { | ||
56 | SBuf *sb = &G(L)->tmpbuf; | ||
57 | setsbufL(sb, L); | ||
58 | lj_buf_reset(sb); | ||
59 | return sb; | ||
60 | } | ||
61 | |||
53 | static LJ_AINLINE void lj_buf_free(global_State *g, SBuf *sb) | 62 | static LJ_AINLINE void lj_buf_free(global_State *g, SBuf *sb) |
54 | { | 63 | { |
55 | lj_mem_free(g, sbufB(sb), sbufsz(sb)); | 64 | lj_mem_free(g, sbufB(sb), sbufsz(sb)); |