updated protobuf to 3.18.1
This commit is contained in:
		| @@ -35,6 +35,8 @@ | ||||
|  | ||||
| #include <google/protobuf/stubs/common.h> | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace google { | ||||
| namespace protobuf { | ||||
|  | ||||
| @@ -48,6 +50,18 @@ inline void STLStringResizeUninitialized(std::string* s, size_t new_size) { | ||||
|   s->resize(new_size); | ||||
| } | ||||
|  | ||||
| // As above, but we make sure to follow amortized growth in which we always | ||||
| // increase the capacity by at least a constant factor >1. | ||||
| inline void STLStringResizeUninitializedAmortized(std::string* s, | ||||
|                                                   size_t new_size) { | ||||
|   const size_t cap = s->capacity(); | ||||
|   if (new_size > cap) { | ||||
|     // Make sure to always grow by at least a factor of 2x. | ||||
|     s->reserve(std::max(new_size, 2 * cap)); | ||||
|   } | ||||
|   STLStringResizeUninitialized(s, new_size); | ||||
| } | ||||
|  | ||||
| // Return a mutable char* pointing to a string's internal buffer, | ||||
| // which may not be null-terminated. Writing through this pointer will | ||||
| // modify the string. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user