signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.55k stars 415 forks source link

bridge: Simplify bridge_deserialize and remove bridge_get_optional_bytearray #388

Closed jrose-signal closed 2 years ago

jrose-signal commented 2 years ago

Unlike bridge_get! or bridge_get_bytearray!, bridge_deserialize! doesn't do any complicated transformation of the return value to accept optional or non-optional, failable and non-failable results alike. At the same time, its syntax has been subtly different from the other bridge_fn macros, dating from when we were first setting up this library. Since the extra parameters to rename or disable a particular bridge's entry point were rarely used, this PR removes them and replaces those use sites with spelled-out bridge_fns. This in turn allows removing the custom per-bridge implementations of bridge_deserialize in favor of a bridge_fn-based implementation like bridge_get! already has.

Similarly, bridge_get_optional_bytearray! was used exactly once, which doesn't justify its complicated generic implementation.