Re: pgcrypto: PGP armor headers - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: pgcrypto: PGP armor headers
Date
Msg-id 542421E4.4030608@vmware.com
Whole thread Raw
In response to Re: pgcrypto: PGP armor headers  (Marko Tiikkaja <marko@joh.to>)
Responses Re: pgcrypto: PGP armor headers
List pgsql-hackers
On 09/25/2014 04:56 PM, Marko Tiikkaja wrote:
> On 9/25/14 3:50 PM, Heikki Linnakangas wrote:
>> On 09/10/2014 04:35 PM, Marko Tiikkaja wrote:
>> It might've been a tad more efficient to return
>> the StringInfo buffer directly from pgp_armor/dearmor, and avoid the
>> extra palloc and memcpy, but this isn't performance critical enough for
>> it to really matter.
>
> I couldn't see any way of doing that without breaking the VARDATA
> abstraction.  I even went looking for similar cases in the source code,
> but couldn't find any.  If you can come up with a way, feel free to
> change that -- I'd like to learn myself.

You could first append VARHDRSZ zeros to the StringInfo, then append the 
base64-encoded data, and last replace the zeros with the real length, 
using SET_VARSIZE.

>> Are you planning to post the main patch rebased on top of this soon? As
>> in the next day or two? Otherwise I'll mark this as "Returned with
>> feedback" for this commitfest.
>
> Yes.  With good luck I'll get you a rebased one today, otherwise it'll
> have to wait until tomorrow.

Ok, I'll leave this in Waiting on Author state then.

- Heikki




pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Scaling shared buffer eviction
Next
From: Robert Haas
Date:
Subject: Re: Scaling shared buffer eviction