blob: 832eff712f9023c0b6dbd7d7665559e1902b1739 [file]
diff --git a/tinycbor/open_memstream.c b/tinycbor/open_memstream.c
index 3365378..37a0d08 100644
--- a/tinycbor/open_memstream.c
+++ b/tinycbor/open_memstream.c
@@ -32,13 +32,13 @@
#include <stdlib.h>
#include <string.h>
-#if defined(__unix__) || defined(__APPLE__)
+#if defined(__unix__) || defined(__APPLE__) || defined(__NuttX__)
# include <unistd.h>
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__)
typedef int RetType;
typedef int LenType;
-#elif __linux__
+#elif defined(__linux__) || defined(__NuttX__)
typedef ssize_t RetType;
typedef size_t LenType;
#else
@@ -99,9 +99,9 @@ FILE *open_memstream(char **bufptr, size_t *lenptr)
*bufptr = NULL;
*lenptr = 0;
-#ifdef __APPLE__
+#if defined(__APPLE__)
return funopen(b, NULL, write_to_buffer, NULL, close_buffer);
-#elif __linux__
+#elif defined(__linux__) || defined(__NuttX__)
static const cookie_io_functions_t vtable = {
NULL,
write_to_buffer,