@@ -35,13 +35,13 @@ extern void pq_sendfloat4(StringInfo buf, float4 f);
35
35
extern void pq_sendfloat8 (StringInfo buf , float8 f );
36
36
37
37
/*
38
- * Append a int8 to a StringInfo buffer, which already has enough space
38
+ * Append an int8 to a StringInfo buffer, which already has enough space
39
39
* preallocated.
40
40
*
41
41
* The use of pg_restrict allows the compiler to optimize the code based on
42
42
* the assumption that buf, buf->len, buf->data and *buf->data don't
43
43
* overlap. Without the annotation buf->len etc cannot be kept in a register
44
- * over subsequent pq_writeint* calls.
44
+ * over subsequent pq_writeintN calls.
45
45
*
46
46
* The use of StringInfoData * rather than StringInfo is due to MSVC being
47
47
* overly picky and demanding a * before a restrict.
@@ -51,51 +51,51 @@ pq_writeint8(StringInfoData *pg_restrict buf, int8 i)
51
51
{
52
52
int8 ni = i ;
53
53
54
- Assert (buf -> len + sizeof (i ) <= buf -> maxlen );
55
- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (ni ));
56
- buf -> len += sizeof (i );
54
+ Assert (buf -> len + sizeof (int8 ) <= buf -> maxlen );
55
+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int8 ));
56
+ buf -> len += sizeof (int8 );
57
57
}
58
58
59
59
/*
60
- * Append a int16 to a StringInfo buffer, which already has enough space
60
+ * Append an int16 to a StringInfo buffer, which already has enough space
61
61
* preallocated.
62
62
*/
63
63
static inline void
64
64
pq_writeint16 (StringInfoData * pg_restrict buf , int16 i )
65
65
{
66
66
int16 ni = pg_hton16 (i );
67
67
68
- Assert (buf -> len + sizeof (ni ) <= buf -> maxlen );
69
- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (i ));
70
- buf -> len += sizeof (i );
68
+ Assert (buf -> len + sizeof (int16 ) <= buf -> maxlen );
69
+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int16 ));
70
+ buf -> len += sizeof (int16 );
71
71
}
72
72
73
73
/*
74
- * Append a int32 to a StringInfo buffer, which already has enough space
74
+ * Append an int32 to a StringInfo buffer, which already has enough space
75
75
* preallocated.
76
76
*/
77
77
static inline void
78
78
pq_writeint32 (StringInfoData * pg_restrict buf , int32 i )
79
79
{
80
80
int32 ni = pg_hton32 (i );
81
81
82
- Assert (buf -> len + sizeof (i ) <= buf -> maxlen );
83
- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (i ));
84
- buf -> len += sizeof (i );
82
+ Assert (buf -> len + sizeof (int32 ) <= buf -> maxlen );
83
+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int32 ));
84
+ buf -> len += sizeof (int32 );
85
85
}
86
86
87
87
/*
88
- * Append a int64 to a StringInfo buffer, which already has enough space
88
+ * Append an int64 to a StringInfo buffer, which already has enough space
89
89
* preallocated.
90
90
*/
91
91
static inline void
92
92
pq_writeint64 (StringInfoData * pg_restrict buf , int64 i )
93
93
{
94
94
int64 ni = pg_hton64 (i );
95
95
96
- Assert (buf -> len + sizeof (i ) <= buf -> maxlen );
97
- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (i ));
98
- buf -> len += sizeof (i );
96
+ Assert (buf -> len + sizeof (int64 ) <= buf -> maxlen );
97
+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int64 ));
98
+ buf -> len += sizeof (int64 );
99
99
}
100
100
101
101
/*
@@ -131,31 +131,31 @@ pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str)
131
131
static inline void
132
132
pq_sendint8 (StringInfo buf , int8 i )
133
133
{
134
- enlargeStringInfo (buf , sizeof (i ));
134
+ enlargeStringInfo (buf , sizeof (int8 ));
135
135
pq_writeint8 (buf , i );
136
136
}
137
137
138
138
/* append a binary int16 to a StringInfo buffer */
139
139
static inline void
140
140
pq_sendint16 (StringInfo buf , int16 i )
141
141
{
142
- enlargeStringInfo (buf , sizeof (i ));
142
+ enlargeStringInfo (buf , sizeof (int16 ));
143
143
pq_writeint16 (buf , i );
144
144
}
145
145
146
146
/* append a binary int32 to a StringInfo buffer */
147
147
static inline void
148
148
pq_sendint32 (StringInfo buf , int32 i )
149
149
{
150
- enlargeStringInfo (buf , sizeof (i ));
150
+ enlargeStringInfo (buf , sizeof (int32 ));
151
151
pq_writeint32 (buf , i );
152
152
}
153
153
154
154
/* append a binary int64 to a StringInfo buffer */
155
155
static inline void
156
156
pq_sendint64 (StringInfo buf , int64 i )
157
157
{
158
- enlargeStringInfo (buf , sizeof (i ));
158
+ enlargeStringInfo (buf , sizeof (int64 ));
159
159
pq_writeint64 (buf , i );
160
160
}
161
161
@@ -169,7 +169,7 @@ pq_sendbyte(StringInfo buf, int8 byt)
169
169
/*
170
170
* Append a binary integer to a StringInfo buffer
171
171
*
172
- * This function is deprecated.
172
+ * This function is deprecated; prefer use of the functions above .
173
173
*/
174
174
static inline void
175
175
pq_sendint (StringInfo buf , int i , int b )
0 commit comments