diff options
| author | mowgli <[email protected]> | 2022-02-10 16:49:25 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:25 +0300 | 
| commit | 56c39b3cf908e7202b1f7551a1653681e8015607 (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/util/merge.cpp | |
| parent | 89afbbe4ca0e02e386dd4df08f7945f190dc1b84 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/util/merge.cpp')
| -rw-r--r-- | library/cpp/protobuf/util/merge.cpp | 26 | 
1 files changed, 13 insertions, 13 deletions
| diff --git a/library/cpp/protobuf/util/merge.cpp b/library/cpp/protobuf/util/merge.cpp index 4af4431d462..dc2b9cc8069 100644 --- a/library/cpp/protobuf/util/merge.cpp +++ b/library/cpp/protobuf/util/merge.cpp @@ -1,30 +1,30 @@ -#include "merge.h"  +#include "merge.h"  #include "simple_reflection.h"  #include <google/protobuf/message.h>  #include <library/cpp/protobuf/util/proto/merge.pb.h> -  -namespace NProtoBuf {  + +namespace NProtoBuf {      void RewriteMerge(const Message& src, Message& dst) {          const Descriptor* d = src.GetDescriptor();          Y_ASSERT(d == dst.GetDescriptor()); -  +          for (int i = 0; i < d->field_count(); ++i) {              if (TConstField(src, d->field(i)).Has())                  TMutableField(dst, d->field(i)).Clear();          } -  +          dst.MergeFrom(src); -    }  -  +    } +      static void ClearNonMergeable(const Message& src, Message& dst) {          const Descriptor* d = src.GetDescriptor();          if (d->options().GetExtension(DontMerge)) {              dst.Clear();              return;          } -  +          for (int i = 0; i < d->field_count(); ++i) {              const FieldDescriptor* fd = d->field(i);              TConstField srcField(src, fd); @@ -36,11 +36,11 @@ namespace NProtoBuf {                      ClearNonMergeable(*srcField.Get<const Message*>(), *dstField.MutableMessage());              }          } -    }  -  +    } +      void CustomMerge(const Message& src, Message& dst) {          ClearNonMergeable(src, dst);          dst.MergeFrom(src); -    }  -  -}  +    } + +} | 
