summaryrefslogtreecommitdiff
path: root/src/upb_string.h
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2011-06-17 10:34:29 -0700
committerJoshua Haberman <jhaberman@gmail.com>2011-06-17 10:34:29 -0700
commit559e23c796f973a65d05c76e211835b126ee8ac8 (patch)
treeec359628f3b93b88718cc34e5ec86ca6e6c6c1e2 /src/upb_string.h
parenta503b8859c37906ab5012db163daca43bfe393bb (diff)
Major refactoring: abandon upb_msg, add upb_accessors.
Next on the chopping block is upb_string.
Diffstat (limited to 'src/upb_string.h')
-rw-r--r--src/upb_string.h6
1 files changed, 5 insertions, 1 deletions
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;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback