aboutsummaryrefslogtreecommitdiff
path: root/ruby/ext/google/protobuf_c/protobuf.h
diff options
context:
space:
mode:
authorChris Fallin <cfallin@google.com>2015-02-02 13:03:08 -0800
committerChris Fallin <cfallin@google.com>2015-02-02 13:03:08 -0800
commiteb33f9d3d6f1f78ee70f4bea4326adaf035e1e67 (patch)
tree3d3bd24d98f81fcdea8a2c819e1fb49faca08042 /ruby/ext/google/protobuf_c/protobuf.h
parent07b8b0f28d1ad88c7c1c64e8707dab8537313c26 (diff)
downloadprotobuf-eb33f9d3d6f1f78ee70f4bea4326adaf035e1e67.tar.gz
protobuf-eb33f9d3d6f1f78ee70f4bea4326adaf035e1e67.tar.bz2
protobuf-eb33f9d3d6f1f78ee70f4bea4326adaf035e1e67.zip
Updated based on code-review comments.
Diffstat (limited to 'ruby/ext/google/protobuf_c/protobuf.h')
-rw-r--r--ruby/ext/google/protobuf_c/protobuf.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/ruby/ext/google/protobuf_c/protobuf.h b/ruby/ext/google/protobuf_c/protobuf.h
index 5b94ae26..d8a327aa 100644
--- a/ruby/ext/google/protobuf_c/protobuf.h
+++ b/ruby/ext/google/protobuf_c/protobuf.h
@@ -292,6 +292,15 @@ void native_slot_set(upb_fieldtype_t type,
VALUE type_class,
void* memory,
VALUE value);
+// Atomically (with respect to Ruby VM calls) either update the value and set a
+// oneof case, or do neither. If |case_memory| is null, then no case value is
+// set.
+void native_slot_set_value_and_case(upb_fieldtype_t type,
+ VALUE type_class,
+ void* memory,
+ VALUE value,
+ uint32_t* case_memory,
+ uint32_t case_number);
VALUE native_slot_get(upb_fieldtype_t type,
VALUE type_class,
const void* memory);
@@ -313,6 +322,11 @@ VALUE field_type_class(const upb_fielddef* field);
#define MAP_KEY_FIELD 1
#define MAP_VALUE_FIELD 2
+// Oneof case slot value to indicate that no oneof case is set. The value `0` is
+// safe because field numbers are used as case identifiers, and no field can
+// have a number of 0.
+#define ONEOF_CASE_NONE 0
+
// These operate on a map field (i.e., a repeated field of submessages whose
// submessage type is a map-entry msgdef).
bool is_map_field(const upb_fielddef* field);