From a230cf5053ce553d92ba5efb51324149fae201b6 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 22 Dec 2009 06:11:58 -0800 Subject: More work. --- src/upb_data.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/upb_data.c') diff --git a/src/upb_data.c b/src/upb_data.c index 66e9885..3c8b244 100644 --- a/src/upb_data.c +++ b/src/upb_data.c @@ -19,6 +19,10 @@ static uint32_t round_up_to_pow2(uint32_t v) return v; } +static void check_not_frozen(upb_data *d) { + if(upb_data_hasflag(d, UPB_DATA_FROZEN)) abort(); +} + upb_string *upb_string_new() { upb_string *s = malloc(sizeof(*s)); s->byte_size = 0; @@ -35,14 +39,9 @@ static void _upb_string_free(upb_string *s) free(s); } -INLINE upb_string *upb_string_getref(upb_string *s, upb_flags_t ref_flags) { - if((ref_flags == UPB_REF_FROZEN && !s->is_frozen && s - upb_atomic_read((void*)(s + 1)) > 1) || - (ref_flags == UPB_REF_MUTABLE && s->is_frozen && -} - char *upb_string_getrwbuf(upb_string *s, upb_strlen_t byte_len) { + check_not_frozen(s); if(s->byte_size < byte_len) { // Need to resize. s->byte_size = round_up_to_pow2(byte_len); -- cgit v1.2.3