From 0124bfd8fe87cb38fe367478d18f449edce8a0ae Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 21 Jun 2009 17:58:23 -0700 Subject: More work on inttable/strtable (not finished). --- upb.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'upb.h') diff --git a/upb.h b/upb.h index 36abcaa..a144218 100644 --- a/upb.h +++ b/upb.h @@ -10,6 +10,7 @@ #include #include #include /* for size_t. */ +#include #ifdef __cplusplus extern "C" { @@ -28,6 +29,17 @@ extern "C" { /* The maximum that any submessages can be nested. Matches proto2's limit. */ #define UPB_MAX_NESTING 64 +/* Represents a string or bytes. */ +struct upb_string { + void *data; + uint32_t byte_len; +}; + +INLINE bool upb_string_eql(struct upb_string *s1, struct upb_string *s2) { + return s1->byte_len == s2->byte_len && + memcmp(s1->data, s2->data, s1->byte_len) == 0; +} + /* A list of types as they are encoded on-the-wire. */ enum upb_wire_type { UPB_WIRE_TYPE_VARINT = 0, -- cgit v1.2.3