summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-05-22 13:47:05 -0700
committerGitHub <noreply@github.com>2017-05-22 13:47:05 -0700
commit27a3f8fac98751ce3b7f040a6d6d01d3dde5bcd5 (patch)
tree1963b21d22abe687d9261c82d630e4cb0660b341 /src
parent7fd2cffc595216e74befef2467b9acb37e82ebd0 (diff)
downloadwabt-27a3f8fac98751ce3b7f040a6d6d01d3dde5bcd5.tar.gz
wabt-27a3f8fac98751ce3b7f040a6d6d01d3dde5bcd5.tar.bz2
wabt-27a3f8fac98751ce3b7f040a6d6d01d3dde5bcd5.zip
Update testsuite; fix bug w/ \0 in export name (#444)
Diffstat (limited to 'src')
-rw-r--r--src/common.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/common.h b/src/common.h
index 3692aa45..9560cd1c 100644
--- a/src/common.h
+++ b/src/common.h
@@ -17,14 +17,13 @@
#ifndef WABT_COMMON_H_
#define WABT_COMMON_H_
-#include <assert.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include <cassert>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <string>
#include <type_traits>
#include <vector>
@@ -236,7 +235,9 @@ static WABT_INLINE char* wabt_strndup(const char* s, size_t len) {
static WABT_INLINE StringSlice dup_string_slice(StringSlice str) {
StringSlice result;
- result.start = wabt_strndup(str.start, str.length);
+ char* new_data = new char[str.length];
+ memcpy(new_data, str.start, str.length);
+ result.start = new_data;
result.length = str.length;
return result;
}