mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Add resetStringInfo(), which clears the content of a StringInfo, and
fixup various places in the tree that were clearing a StringInfo by hand. Making this function a part of the API simplifies client code slightly, and avoids needlessly peeking inside the StringInfo interface.
This commit is contained in:
@ -30,7 +30,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.190 2007/02/13 19:18:53 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.191 2007/03/03 19:32:54 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -860,10 +860,7 @@ pq_getstring(StringInfo s)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Reset string to empty */
|
||||
s->len = 0;
|
||||
s->data[0] = '\0';
|
||||
s->cursor = 0;
|
||||
resetStringInfo(s);
|
||||
|
||||
/* Read until we get the terminating '\0' */
|
||||
for (;;)
|
||||
@ -915,10 +912,7 @@ pq_getmessage(StringInfo s, int maxlen)
|
||||
{
|
||||
int32 len;
|
||||
|
||||
/* Reset message buffer to empty */
|
||||
s->len = 0;
|
||||
s->data[0] = '\0';
|
||||
s->cursor = 0;
|
||||
resetStringInfo(s);
|
||||
|
||||
/* Read message length word */
|
||||
if (pq_getbytes((char *) &len, 4) == EOF)
|
||||
|
Reference in New Issue
Block a user