aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_buf.c10
-rw-r--r--src/lj_buf.h8
2 files changed, 7 insertions, 11 deletions
diff --git a/src/lj_buf.c b/src/lj_buf.c
index 2a1d7f8e..1786c10d 100644
--- a/src/lj_buf.c
+++ b/src/lj_buf.c
@@ -57,15 +57,7 @@ char * LJ_FASTCALL lj_buf_tmp(lua_State *L, MSize sz)
57 57
58/* -- Low-level buffer put operations ------------------------------------- */ 58/* -- Low-level buffer put operations ------------------------------------- */
59 59
60/* Write memory block to buffer. */ 60SBuf *lj_buf_putmem(SBuf *sb, const void *q, MSize len)
61char *lj_buf_wmem(char *p, const void *q, MSize len)
62{
63 const char *s = (const char *)q, *e = s + len;
64 while (s < e) *p++ = *s++;
65 return p;
66}
67
68SBuf * lj_buf_putmem(SBuf *sb, const void *q, MSize len)
69{ 61{
70 char *p = lj_buf_more(sb, len); 62 char *p = lj_buf_more(sb, len);
71 p = lj_buf_wmem(p, q, len); 63 p = lj_buf_wmem(p, q, len);
diff --git a/src/lj_buf.h b/src/lj_buf.h
index 951d39fd..5f78c4a9 100644
--- a/src/lj_buf.h
+++ b/src/lj_buf.h
@@ -66,13 +66,17 @@ static LJ_AINLINE char *lj_buf_more(SBuf *sb, MSize sz)
66} 66}
67 67
68/* Low-level buffer put operations */ 68/* Low-level buffer put operations */
69LJ_FUNC char *lj_buf_wmem(char *p, const void *q, MSize len); 69LJ_FUNC SBuf *lj_buf_putmem(SBuf *sb, const void *q, MSize len);
70LJ_FUNC SBuf * lj_buf_putmem(SBuf *sb, const void *q, MSize len);
71#if LJ_HASJIT 70#if LJ_HASJIT
72LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c); 71LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c);
73#endif 72#endif
74LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putstr(SBuf *sb, GCstr *s); 73LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putstr(SBuf *sb, GCstr *s);
75 74
75static LJ_AINLINE char *lj_buf_wmem(char *p, const void *q, MSize len)
76{
77 return (char *)memcpy(p, q, len) + len;
78}
79
76static LJ_AINLINE void lj_buf_putb(SBuf *sb, int c) 80static LJ_AINLINE void lj_buf_putb(SBuf *sb, int c)
77{ 81{
78 char *p = lj_buf_more(sb, 1); 82 char *p = lj_buf_more(sb, 1);