diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-06-21 17:58:23 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-06-21 17:58:23 -0700 |
commit | 0124bfd8fe87cb38fe367478d18f449edce8a0ae (patch) | |
tree | 431eaaa412d8bdab1afdc84d32ff8375d851c08c /upb.h | |
parent | 9c21992286a5b6a3559f0ae9e191b417a8e4c06c (diff) |
More work on inttable/strtable (not finished).
Diffstat (limited to 'upb.h')
-rw-r--r-- | upb.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -10,6 +10,7 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> /* for size_t. */ +#include <string.h> #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, |