Add PB_SYSTEM_HEADER compile time option.
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>
Sat, 9 Mar 2013 12:56:34 +0000 (14:56 +0200)
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>
Sat, 9 Mar 2013 12:56:34 +0000 (14:56 +0200)
This allows replacing the C99 standard include file names with
a single system-specific file. It should provide all the necessary
system functions (typedefs, memset, memcpy, strlen).

Update issue 62
Status: FixedInGit

pb.h
pb_decode.c
pb_encode.c

diff --git a/pb.h b/pb.h
index b12debe..138c6bb 100644 (file)
--- a/pb.h
+++ b/pb.h
@@ -8,9 +8,14 @@
 
 #define NANOPB_VERSION nanopb-0.2.1-dev
 
+#ifdef PB_SYSTEM_HEADER
+#include PB_SYSTEM_HEADER
+#else
 #include <stdint.h>
 #include <stddef.h>
 #include <stdbool.h>
+#include <string.h>
+#endif
 
 #ifdef __GNUC__
 /* This just reduces memory requirements, but is not required. */
index 91b68ea..6e81b40 100644 (file)
@@ -14,7 +14,6 @@
 #define NANOPB_INTERNALS
 #include "pb.h"
 #include "pb_decode.h"
-#include <string.h>
 
 typedef bool (*pb_decoder_t)(pb_istream_t *stream, const pb_field_t *field, void *dest) checkreturn;
 
index fd4b6ba..7acee36 100644 (file)
@@ -6,7 +6,6 @@
 #define NANOPB_INTERNALS
 #include "pb.h"
 #include "pb_encode.h"
-#include <string.h>
 
 /* The warn_unused_result attribute appeared first in gcc-3.4.0 */
 #if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)