aboutsummaryrefslogtreecommitdiff
path: root/src/buffer.hpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-11-06 22:11:47 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-11-06 22:11:47 -0700
commit72be61fc0a0cb552c8eec1d9d4b8ccacf64f491c (patch)
tree9ed920d629cb02894f3f134144d7b2f1083b9f29 /src/buffer.hpp
parent4ecb37a8a4ab552705445a7299bac266c3e06720 (diff)
downloadzig-72be61fc0a0cb552c8eec1d9d4b8ccacf64f491c.tar.gz
zig-72be61fc0a0cb552c8eec1d9d4b8ccacf64f491c.zip
generated parser understands tuples
Diffstat (limited to 'src/buffer.hpp')
-rw-r--r--src/buffer.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buffer.hpp b/src/buffer.hpp
index 47975f5fe9..88d9415d34 100644
--- a/src/buffer.hpp
+++ b/src/buffer.hpp
@@ -55,6 +55,14 @@ static inline void buf_init_from_mem(Buf *buf, const char *ptr, int len) {
buf->list.at(buf_len(buf)) = 0;
}
+static inline void buf_init_from_str(Buf *buf, const char *str) {
+ buf_init_from_mem(buf, str, strlen(str));
+}
+
+static inline void buf_init_from_buf(Buf *buf, Buf *other) {
+ buf_init_from_mem(buf, buf_ptr(other), buf_len(other));
+}
+
static inline Buf *buf_create_from_mem(const char *ptr, int len) {
Buf *buf = allocate<Buf>(1);
buf_init_from_mem(buf, ptr, len);