From 559e23c796f973a65d05c76e211835b126ee8ac8 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 17 Jun 2011 10:34:29 -0700 Subject: Major refactoring: abandon upb_msg, add upb_accessors. Next on the chopping block is upb_string. --- src/upb_string.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/upb_string.h') diff --git a/src/upb_string.h b/src/upb_string.h index 1463bbf..1f92850 100644 --- a/src/upb_string.h +++ b/src/upb_string.h @@ -107,6 +107,8 @@ void _upb_string_free(upb_string *str); // can be NULL, in which case this is a no-op. WARNING: NOT THREAD_SAFE // UNLESS THE STRING IS SYNCHRONIZED. INLINE void upb_string_unref(upb_string *str) { + if (str) { + } if (str && upb_atomic_read(&str->refcount) > 0 && upb_atomic_unref(&str->refcount)) { _upb_string_free(str); @@ -129,7 +131,9 @@ INLINE upb_string *upb_string_getref(upb_string *str) { int refcount = upb_atomic_read(&str->refcount); if (refcount == _UPB_STRING_REFCOUNT_STACK) return upb_strdup(str); // We don't ref the special <0 refcount for static strings. - if (refcount > 0) upb_atomic_ref(&str->refcount); + if (refcount > 0) { + upb_atomic_ref(&str->refcount); + } return str; } -- cgit v1.2.3