diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2015-05-28 09:43:25 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2015-05-28 09:43:25 -0700 |
commit | 0b64534a4450d6d198ce617209ebe38816b028ef (patch) | |
tree | 6e528d4ffc3a56d16a24ebfa8f4894cae0d39968 /upb/refcounted.c | |
parent | e6dddd6c175cb23946c2d36180b3c2ef8d30e6ec (diff) | |
parent | 2cff15d35e4ff862e6a0811ae9e509c3d3352514 (diff) |
Merge pull request #21 from google/tablestrings
Restructure tables for C89 port and smaller size.
Diffstat (limited to 'upb/refcounted.c')
-rw-r--r-- | upb/refcounted.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/upb/refcounted.c b/upb/refcounted.c index 40e6e89..fa775ab 100644 --- a/upb/refcounted.c +++ b/upb/refcounted.c @@ -726,6 +726,18 @@ static void freeobj(upb_refcounted *o) { bool upb_refcounted_init(upb_refcounted *r, const struct upb_refcounted_vtbl *vtbl, const void *owner) { +#ifndef NDEBUG + // Endianness check. This is unrelated to upb_refcounted, it's just a + // convenient place to put the check that we can be assured will run for + // basically every program using upb. + const int x = 1; +#ifdef UPB_BIG_ENDIAN + assert(*(char*)&x != 1); +#else + assert(*(char*)&x == 1); +#endif +#endif + r->next = r; r->vtbl = vtbl; r->individual_count = 0; |