Skip to content

Commit

Permalink
serdes: simplify handling of basic types
Browse files Browse the repository at this point in the history
This commit removes a macro, and fixes compilation errors on
certain platforms such as NetBSD 8.2.

Refs: nodejs/node#34510
Fixes: #145
  • Loading branch information
addaleax authored and cjihrig committed Aug 2, 2020
1 parent d8396d5 commit 38c0c10
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/wasi_serdes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
void uvwasi_serdes_write_##name(void* ptr, size_t offset, type value); \
type uvwasi_serdes_read_##name(const void* ptr, size_t offset); \

#define BASIC_TYPE(type) BASIC_TYPE_(type, type)
#define BASIC_TYPE_UVWASI(type) BASIC_TYPE_(type, uvwasi_##type)

#define UVWASI_SERDES_SIZE_uint8_t sizeof(uint8_t)
BASIC_TYPE(uint8_t)
BASIC_TYPE_(uint8_t, uint8_t)
#define UVWASI_SERDES_SIZE_uint16_t sizeof(uint16_t)
BASIC_TYPE(uint16_t)
BASIC_TYPE_(uint16_t, uint16_t)
#define UVWASI_SERDES_SIZE_uint32_t sizeof(uint32_t)
BASIC_TYPE(uint32_t)
BASIC_TYPE_(uint32_t, uint32_t)
#define UVWASI_SERDES_SIZE_uint64_t sizeof(uint64_t)
BASIC_TYPE(uint64_t)
BASIC_TYPE_(uint64_t, uint64_t)

#define UVWASI_SERDES_SIZE_advice_t sizeof(uvwasi_advice_t)
BASIC_TYPE_UVWASI(advice_t)
Expand Down

0 comments on commit 38c0c10

Please sign in to comment.