summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-08-02 23:40:21 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-08-02 23:40:21 -0700
commit3fde2b26cda7eed5e55068e51061c99ca64bc372 (patch)
tree9cc876c116330d08c4a2d98784847b4a940a6da9 /src
parent10cdab28e983187a2c99c4bf66053954846f051d (diff)
Remove commented-out code that was moved to upb_msg.c.
Diffstat (limited to 'src')
-rw-r--r--src/upb_text.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/upb_text.c b/src/upb_text.c
index 7ca17cc..6e17777 100644
--- a/src/upb_text.c
+++ b/src/upb_text.c
@@ -78,56 +78,3 @@ void upb_text_pop(struct upb_text_printer *p,
print_indent(p, stream);
fprintf(stream, "}\n");
}
-
-#if 0
-bool upb_array_eql(struct upb_array *arr1, struct upb_array *arr2,
- struct upb_msg_field *f, bool recursive)
-{
- if(arr1->len != arr2->len) return false;
- if(upb_issubmsg(f)) {
- if(!recursive) return true;
- for(uint32_t i = 0; i < arr1->len; i++)
- if(!upb_msg_eql(arr1->elements.msg[i], arr2->elements.msg[i],
- f->ref.msg, recursive))
- return false;
- } else if(upb_isstring(f)) {
- for(uint32_t i = 0; i < arr1->len; i++)
- if(!upb_streql(arr1->elements.str[i], arr2->elements.str[i]))
- return false;
- } else {
- /* For primitive types we can compare the memory directly. */
- return memcmp(arr1->elements._void, arr2->elements._void,
- arr1->len * upb_type_info[f->type].size) == 0;
- }
- return true;
-}
-
- void *data1, struct upb_msg *m, bool single_line)
- /* Must have the same fields set. TODO: is this wrong? Should we also
- * consider absent defaults equal to explicitly set defaults? */
- if(memcmp(data1, data2, m->set_flags_bytes) != 0)
- return false;
-
- /* Possible optimization: create a mask of the bytes in the messages that
- * contain only primitive values (not strings, arrays, submessages, or
- * padding) and memcmp the masked messages. */
-
- for(uint32_t i = 0; i < m->num_fields; i++) {
- struct upb_msg_field *f = &m->fields[i];
- if(!upb_msg_is_set(data1, f)) continue;
- union upb_value_ptr p1 = upb_msg_getptr(data1, f);
- union upb_value_ptr p2 = upb_msg_getptr(data2, f);
- if(f->label == GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_REPEATED) {
- if(!upb_array_eql(*p1.arr, *p2.arr, f, recursive)) return false;
- } else {
- if(upb_issubmsg(f)) {
- if(recursive && !upb_msg_eql(p1.msg, p2.msg, f->ref.msg, recursive))
- return false;
- } else if(!upb_value_eql(p1, p2, f->type)) {
- return false;
- }
- }
- }
- return true;
-}
-#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback