Skip to content

Conversation

@copybara-service
Copy link

Made a common longjmp()-handling layer, which can optionally be used on upb_EpsCopyInputStream.

upb_EpsCopyInputStream and upb_WireReader can now report all errors via longjmp() when an error handler is installed.

This lets us unwind some complexity:

  • The decoder can now just use upb_WireReader_Read*(), instead of having a separate copy of those functions solely so that errors can longjmp().
  • upb_EpsCopyInputStream no longer needs to support a custom callback for IsDoneFallback, which existed solely so that errors could longjmp(). This allows us to move upb_EpsCopyInputStream_IsDoneFallback() out of the header and into the source file, where fallback functions belong.

In future CLs we can apply the same pattern to upb_Arena so that allocation failures will longjmp().

…on `upb_EpsCopyInputStream`.

`upb_EpsCopyInputStream` and `upb_WireReader` can now report all errors via `longjmp()` when an error handler is installed.

This lets us unwind some complexity:

* The decoder can now just use `upb_WireReader_Read*()`, instead of having a separate copy of those functions solely so that errors can `longjmp()`.
* `upb_EpsCopyInputStream` no longer needs to support a custom callback for `IsDoneFallback`, which existed solely so that errors could `longjmp()`.  This allows us to move `upb_EpsCopyInputStream_IsDoneFallback()` out of the header and into the source file, where fallback functions belong.

In future CLs we can apply the same pattern to `upb_Arena` so that allocation failures will `longjmp()`.

PiperOrigin-RevId: 840817107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant