Use std::copy instead of OPENSSL_memcpy for the internal bssl::Array::CopyFrom
This (internal) abstraction was originally made for trivial types, but if we ever got a complex type, we should use C++ copies, not C copies, to preserve all the rules of that type. A good STL will specialize std::copy to memmove/memcpy when possible, so this should not appreciably change the generated code. Change-Id: I76af334ef667e545dbbbe87315ce5b30a327358c Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66427 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Bob Beck <bbe@google.com>
This commit is contained in:
committed by
Boringssl LUCI CQ
parent
cadebfd639
commit
6db6604cb5
+2
-1
@@ -146,6 +146,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <limits>
|
||||
#include <new>
|
||||
@@ -317,7 +318,7 @@ class Array {
|
||||
if (!Init(in.size())) {
|
||||
return false;
|
||||
}
|
||||
OPENSSL_memcpy(data_, in.data(), sizeof(T) * in.size());
|
||||
std::copy(in.begin(), in.end(), data_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user