I see that palloc.h says:

    The result of palloc() is always word-aligned

void *
repalloc(void *pointer, Size size)
{
...
    /*
     * Try to detect bogus pointers handed to us, poorly though we can.
     * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
     * allocated chunk.
     */
    Assert(pointer != NULL);
    Assert(pointer == (void *) MAXALIGN(pointer));
...




so maybe my alignment fear is misplaced. So my remaining question is
whether this is OK stylistically.

Something like this?
initStringInfoVarlena()/makeStringInfoVarlena()
{
        initStringInfo()
        appendStringInfoSpaces(jtext, VARHDRSZ);
}

char*
formStringInfoVarlena()
{
        SET_VARSIZE(jtext->data, jtext->len);
        return  jtext->data;
}

--
Teodor Sigaev                      E-mail: teo...@sigaev.ru
                                      WWW: http://www.sigaev.ru/


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to