StringInfo Macros - Mailing list pgsql-hackers

From Markus Wanner
Subject StringInfo Macros
Date
Msg-id 20090828161436.18531ajtsuzgrvws@mail.bluegap.ch
Whole thread Raw
Responses Re: StringInfo Macros  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

trying to clean up the Postgres-R code further, I would like to make  
use of StringInfo and accompanying functions in libpq/pqformat.c  
instead of some home-brown duplicate of it. However, I'm missing  
helper macros like these (mainly for readability of the code):

#define BUFFER_START_PTR(buffer) ((buffer)->data))
#define BUFFER_END_PTR(buffer) ((buffer)->data + (buffer)->len)
#define BUFFER_CURSOR_PTR(buffer) ((buffer)->data + (buffer)->cursor)

#define BUFFER_BYTES_FREE(buffer) ((buffer)->maxlen - (buffer)->len)
#define BUFFER_BYTES_READABLE(buffer) ((buffer)->len - (buffer)->cursor)

Is there any compelling reason these don't exist (and shouldn't get  
added)? IF not, I'd be happy to create a patch to add and make use of  
such macros.

Regards

Markus Wanner





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Memory context usage
Next
From: "Kevin Grittner"
Date:
Subject: Re: patch: Review handling of MOVE and FETCH (ToDo)