extern void pq_sendfloat8(StringInfo buf, float8 f);
/*
- * Append a int8 to a StringInfo buffer, which already has enough space
+ * Append an int8 to a StringInfo buffer, which already has enough space
* preallocated.
*
* The use of pg_restrict allows the compiler to optimize the code based on
* the assumption that buf, buf->len, buf->data and *buf->data don't
* overlap. Without the annotation buf->len etc cannot be kept in a register
- * over subsequent pq_writeint* calls.
+ * over subsequent pq_writeintN calls.
*
* The use of StringInfoData * rather than StringInfo is due to MSVC being
* overly picky and demanding a * before a restrict.
{
int8 ni = i;
- Assert(buf->len + sizeof(i) <= buf->maxlen);
- memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(ni));
- buf->len += sizeof(i);
+ Assert(buf->len + sizeof(int8) <= buf->maxlen);
+ memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int8));
+ buf->len += sizeof(int8);
}
/*
- * Append a int16 to a StringInfo buffer, which already has enough space
+ * Append an int16 to a StringInfo buffer, which already has enough space
* preallocated.
*/
static inline void
{
int16 ni = pg_hton16(i);
- Assert(buf->len + sizeof(ni) <= buf->maxlen);
- memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(i));
- buf->len += sizeof(i);
+ Assert(buf->len + sizeof(int16) <= buf->maxlen);
+ memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int16));
+ buf->len += sizeof(int16);
}
/*
- * Append a int32 to a StringInfo buffer, which already has enough space
+ * Append an int32 to a StringInfo buffer, which already has enough space
* preallocated.
*/
static inline void
{
int32 ni = pg_hton32(i);
- Assert(buf->len + sizeof(i) <= buf->maxlen);
- memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(i));
- buf->len += sizeof(i);
+ Assert(buf->len + sizeof(int32) <= buf->maxlen);
+ memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int32));
+ buf->len += sizeof(int32);
}
/*
- * Append a int64 to a StringInfo buffer, which already has enough space
+ * Append an int64 to a StringInfo buffer, which already has enough space
* preallocated.
*/
static inline void
{
int64 ni = pg_hton64(i);
- Assert(buf->len + sizeof(i) <= buf->maxlen);
- memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(i));
- buf->len += sizeof(i);
+ Assert(buf->len + sizeof(int64) <= buf->maxlen);
+ memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int64));
+ buf->len += sizeof(int64);
}
/*
static inline void
pq_sendint8(StringInfo buf, int8 i)
{
- enlargeStringInfo(buf, sizeof(i));
+ enlargeStringInfo(buf, sizeof(int8));
pq_writeint8(buf, i);
}
static inline void
pq_sendint16(StringInfo buf, int16 i)
{
- enlargeStringInfo(buf, sizeof(i));
+ enlargeStringInfo(buf, sizeof(int16));
pq_writeint16(buf, i);
}
static inline void
pq_sendint32(StringInfo buf, int32 i)
{
- enlargeStringInfo(buf, sizeof(i));
+ enlargeStringInfo(buf, sizeof(int32));
pq_writeint32(buf, i);
}
static inline void
pq_sendint64(StringInfo buf, int64 i)
{
- enlargeStringInfo(buf, sizeof(i));
+ enlargeStringInfo(buf, sizeof(int64));
pq_writeint64(buf, i);
}
/*
* Append a binary integer to a StringInfo buffer
*
- * This function is deprecated.
+ * This function is deprecated; prefer use of the functions above.
*/
static inline void
pq_sendint(StringInfo buf, int i, int b)