diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-07-22 19:49:53 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-07-22 19:49:53 -0700 |
commit | ee1ed1ccb87effa403dc91603d452d4c98ed716f (patch) | |
tree | e1ee8c1b38d9351d4d3494c5e45b91b288f3a081 /src/upb_string.h | |
parent | e4e89247e5f7548b5ebdb9a667657cdcb3feb17f (diff) |
Compiler finally works (except string arrays). Untested. Holy crap that was a lot of work.
Diffstat (limited to 'src/upb_string.h')
-rw-r--r-- | src/upb_string.h | 10 |
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; |