summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/common.h b/src/common.h
index f3a61a3d..e728d5ab 100644
--- a/src/common.h
+++ b/src/common.h
@@ -43,9 +43,6 @@
#define WABT_ALIGN_UP_TO_PAGE(x) \
(((x) + WABT_PAGE_SIZE - 1) & ~(WABT_PAGE_SIZE - 1))
-#define PRIstringslice "%.*s"
-#define WABT_PRINTF_STRING_SLICE_ARG(x) static_cast<int>((x).length), (x).start
-
#define PRIstringview "%.*s"
#define WABT_PRINTF_STRING_VIEW_ARG(x) \
static_cast<int>((x).length()), (x).data()
@@ -162,11 +159,6 @@ enum class LabelType {
};
static const int kLabelTypeCount = WABT_ENUM_COUNT(LabelType);
-struct StringSlice {
- const char* start;
- size_t length;
-};
-
struct Location {
enum class Type {
Text,
@@ -255,64 +247,11 @@ struct Limits {
enum { WABT_USE_NATURAL_ALIGNMENT = 0xFFFFFFFF };
-enum class LiteralType {
- Int,
- Float,
- Hexfloat,
- Infinity,
- Nan,
-};
-
-struct Literal {
- LiteralType type;
- StringSlice text;
-};
-
enum class NameSectionSubsection {
Function = 1,
Local = 2,
};
-static WABT_INLINE char* wabt_strndup(const char* s, size_t len) {
- size_t real_len = 0;
- const char* p = s;
- while (real_len < len && *p) {
- p++;
- real_len++;
- }
-
- char* new_s = new char[real_len + 1];
- memcpy(new_s, s, real_len);
- new_s[real_len] = 0;
- return new_s;
-}
-
-static WABT_INLINE StringSlice dup_string_slice(StringSlice str) {
- StringSlice result;
- char* new_data = new char[str.length];
- memcpy(new_data, str.start, str.length);
- result.start = new_data;
- result.length = str.length;
- return result;
-}
-
-StringSlice empty_string_slice(void);
-bool string_slice_eq_cstr(const StringSlice* s1, const char* s2);
-StringSlice string_slice_from_cstr(const char* string);
-bool string_slice_is_empty(const StringSlice*);
-void destroy_string_slice(StringSlice*);
-
-inline std::string string_slice_to_string(const StringSlice& ss) {
- return std::string(ss.start, ss.length);
-}
-
-inline StringSlice string_view_to_string_slice(string_view view) {
- StringSlice ss;
- ss.start = view.data();
- ss.length = view.length();
- return ss;
-}
-
Result ReadFile(const char* filename, std::vector<uint8_t>* out_data);
void init_stdio();