From d91116176642f24ef1b2c2431e7c5c3150bbad68 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 15 Jul 2024 13:35:41 -0700 Subject: [PATCH] Update the comment of TextFormat::Printer::RegisterMessagePrinter that the method takes ownerhip of the `printer` pointer. The implementation takes ownership of the `printer`. But, the current method signature does not make it clear whether ownership is taken. In fact, since it's a `const *`, it could be easily confused by the callers as _not_ taking ownership. All other `Register...Printer()` methods have comments about taking ownership. This is the only one that was left out. PiperOrigin-RevId: 652584898 --- src/google/protobuf/text_format.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h index 25ef58b3408d..7360aa29e00e 100644 --- a/src/google/protobuf/text_format.h +++ b/src/google/protobuf/text_format.h @@ -440,6 +440,7 @@ class PROTOBUF_EXPORT TextFormat { // particular Descriptor. // Returns "true" if the registration succeeded, or "false" if there is // already a printer for that Descriptor. + // Takes ownership of the printer on successful registration. bool RegisterMessagePrinter(const Descriptor* descriptor, const MessagePrinter* printer);