diff options
-rw-r--r-- | src/lj_buf.c | 10 | ||||
-rw-r--r-- | src/lj_buf.h | 8 |
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. */ | 60 | SBuf *lj_buf_putmem(SBuf *sb, const void *q, MSize len) |
61 | char *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 | |||
68 | SBuf * 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 */ |
69 | LJ_FUNC char *lj_buf_wmem(char *p, const void *q, MSize len); | 69 | LJ_FUNC SBuf *lj_buf_putmem(SBuf *sb, const void *q, MSize len); |
70 | LJ_FUNC SBuf * lj_buf_putmem(SBuf *sb, const void *q, MSize len); | ||
71 | #if LJ_HASJIT | 70 | #if LJ_HASJIT |
72 | LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c); | 71 | LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c); |
73 | #endif | 72 | #endif |
74 | LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putstr(SBuf *sb, GCstr *s); | 73 | LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putstr(SBuf *sb, GCstr *s); |
75 | 74 | ||
75 | static LJ_AINLINE char *lj_buf_wmem(char *p, const void *q, MSize len) | ||
76 | { | ||
77 | return (char *)memcpy(p, q, len) + len; | ||
78 | } | ||
79 | |||
76 | static LJ_AINLINE void lj_buf_putb(SBuf *sb, int c) | 80 | static 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); |