summaryrefslogtreecommitdiff
path: root/core/upb_string.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-05 22:07:10 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-05 22:07:10 -0800
commit806ba1c80d86bd59759cf59efc057662eecbcf65 (patch)
treed30146be1313d6be6818cb1c613fc4ea26b9a7d1 /core/upb_string.h
parent3affb319260263efc3cee502896d9f981186c7da (diff)
Another round of fixes.
test_vs_proto2.googlemessage1 passes again, with no memory leaks!
Diffstat (limited to 'core/upb_string.h')
-rw-r--r--core/upb_string.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/upb_string.h b/core/upb_string.h
index 7d0ae87..4943cbf 100644
--- a/core/upb_string.h
+++ b/core/upb_string.h
@@ -57,6 +57,9 @@ extern "C" {
// All members of this struct are private, and may only be read/written through
// the associated functions.
struct _upb_string {
+ // The string's refcount.
+ upb_atomic_refcount_t refcount;
+
// The pointer to our currently active data. This may be memory we own
// or a pointer into memory we don't own.
const char *ptr;
@@ -76,9 +79,6 @@ struct _upb_string {
uint32_t size;
#endif
- // The string's refcount.
- upb_atomic_refcount_t refcount;
-
// Used if this is a slice of another string, NULL otherwise. We own a ref
// on src.
struct _upb_string *src;
@@ -86,9 +86,9 @@ struct _upb_string {
// Internal-only initializer for upb_string instances.
#ifdef UPB_HAVE_MSIZE
-#define _UPB_STRING_INIT(str, len, refcount) {(char*)str, NULL, len, {refcount}, NULL}
+#define _UPB_STRING_INIT(str, len, refcount) {{refcount}, (char*)str, NULL, len, NULL}
#else
-#define _UPB_STRING_INIT(str, len, refcount) {(char*)str, NULL, len, 0, {refcount}, NULL}
+#define _UPB_STRING_INIT(str, len, refcount) {{refcount}, (char*)str, NULL, len, 0, NULL}
#endif
// Special pseudo-refcounts for static/stack-allocated strings, respectively.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback