Skip to content

Commit

Permalink
Update the comment of TextFormat::Printer::RegisterMessagePrinter tha…
Browse files Browse the repository at this point in the history
…t 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
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jul 15, 2024
1 parent bcd9905 commit d911161
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/google/protobuf/text_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d911161

Please sign in to comment.