Use mut ref for extern_state
Summary: The ownership of this struct (at least within `output_val`) is really clear, so we can easily thread a `&mut` around instead of a `*mut`. Also allocate a fresh state on every invocation of `output_val` instead of keeping one around (it's not clear that there's any reason to do so except avoiding the alloc. We can address that if we find the additional alloc to be a problem).
Reviewed By: shayne-fletcher
Differential Revision:
D39026569
fbshipit-source-id:
456d35d4c9cb43d2a29c41aee0fb6e0b38b402b6