summaryrefslogtreecommitdiff
path: root/src/upb_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/upb_string.h')
-rw-r--r--src/upb_string.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/upb_string.h b/src/upb_string.h
index de2384d..8e56daa 100644
--- a/src/upb_string.h
+++ b/src/upb_string.h
@@ -27,9 +27,15 @@
extern "C" {
#endif
+#include <stdbool.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include "upb.h"
+
+/* inline if possible, emit standalone code if required. */
+#ifndef INLINE
+#define INLINE static inline
+#endif
struct upb_string {
/* We expect the data to be 8-bit clean (uint8_t), but char* is such an
@@ -38,6 +44,8 @@ struct upb_string {
uint32_t byte_len;
};
+INLINE uint32_t min(uint32_t a, uint32_t b) { return a < b ? a : b; }
+
INLINE bool upb_streql(struct upb_string *s1, struct upb_string *s2) {
return s1->byte_len == s2->byte_len &&
memcmp(s1->ptr, s2->ptr, s1->byte_len) == 0;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback