From ee1ed1ccb87effa403dc91603d452d4c98ed716f Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 22 Jul 2009 19:49:53 -0700 Subject: Compiler finally works (except string arrays). Untested. Holy crap that was a lot of work. --- src/upb_string.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/upb_string.h') 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 +#include #include #include -#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; -- cgit v1.2.3