Here's a v2 - note on NULL args/returns - ref PointerGetDatum - used your example. Started adding some comments but don't think they're really necessary. The reader gets the point as-is I think.
v2-0001-Add-some-documentation-on-how-to-call-internal-fu.patch
Description: Binary data
v2-0002-Add-note-on-NULL.-Update-example-to-use-text.patch
Description: Binary data