Skip to content

Commit d911161

Browse files
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
1 parent bcd9905 commit d911161

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/google/protobuf/text_format.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ class PROTOBUF_EXPORT TextFormat {
440440
// particular Descriptor.
441441
// Returns "true" if the registration succeeded, or "false" if there is
442442
// already a printer for that Descriptor.
443+
// Takes ownership of the printer on successful registration.
443444
bool RegisterMessagePrinter(const Descriptor* descriptor,
444445
const MessagePrinter* printer);
445446

0 commit comments

Comments
 (0)