Re: b64_encode and decode - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: b64_encode and decode
Date
Msg-id 4851AC15.5020009@dunslane.net
Whole thread Raw
In response to b64_encode and decode  (Marc Munro <marc@bloodnok.com>)
Responses Re: b64_encode and decode  (Marc Munro <marc@bloodnok.com>)
List pgsql-hackers

Marc Munro wrote:
> I require base64 or some similar encoding scheme from a C language
> extension and need it to be as fast as reasonably possible.  In 
> src/backend/utils/adt/encode.c there are functions b64_encode and
> b64_decode which would be ideal but these are defined static and so are
> not available to my code.
>
> I know I could call these functions indirectly by calling binary_ecncode
> through DirectFunctionCalln() but this is a whole lot more complexity
> and overhead than I'd like.
>
> I note that /contrib/pgcrypto/pgp-armor.c appears to have its own copies
> of these 2 functions and now I have elected to do the same.
>
> So, would there be any chance of redefining the base64 functions in
> encode.c as extern to eliminate this redundancy?
>
>
>   

Just how much complexity do you think calling binary_encode involves? 
You can probably do the whole thing in one or two lines of code.

cheers

andrew





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Options for protocol level cursors
Next
From: Tom Lane
Date:
Subject: Re: b64_encode and decode