diff options
| author | Neil Conway <neilc@samurai.com> | 2007-03-03 19:32:55 +0000 |
|---|---|---|
| committer | Neil Conway <neilc@samurai.com> | 2007-03-03 19:32:55 +0000 |
| commit | 90d76525c5cc2f3f4781351a1d99be839dfa2874 (patch) | |
| tree | 75ee2db58298898533663d779d711879c43edb8d /src/backend/libpq | |
| parent | 053981f4054f6dfcda0ce65566605b49ca366a97 (diff) | |
| download | postgresql-90d76525c5cc2f3f4781351a1d99be839dfa2874.tar.gz | |
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.
Diffstat (limited to 'src/backend/libpq')
| -rw-r--r-- | src/backend/libpq/pqcomm.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index a8f40249c9..d9439e7fd9 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -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) |
