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/utils/adt | |
| 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/utils/adt')
| -rw-r--r-- | src/backend/utils/adt/rowtypes.c | 5 | ||||
| -rw-r--r-- | src/backend/utils/adt/xml.c | 8 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c index d7ea553c95..c856acb0dc 100644 --- a/src/backend/utils/adt/rowtypes.c +++ b/src/backend/utils/adt/rowtypes.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.18 2007/01/05 22:19:42 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.19 2007/03/03 19:32:55 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -168,8 +168,7 @@ record_in(PG_FUNCTION_ARGS) /* Extract string for this column */ bool inquote = false; - buf.len = 0; - buf.data[0] = '\0'; + resetStringInfo(&buf); while (inquote || !(*ptr == ',' || *ptr == ')')) { char ch = *ptr++; diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 547d98df1e..921fe1d9f5 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.33 2007/03/01 14:52:04 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.34 2007/03/03 19:32:55 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -835,8 +835,7 @@ xml_init(void) else { /* Reset pre-existing buffer to empty */ - xml_err_buf->data[0] = '\0'; - xml_err_buf->len = 0; + resetStringInfo(xml_err_buf); } /* Now that xml_err_buf exists, safe to call xml_errorHandler */ xmlSetGenericErrorFunc(NULL, xml_errorHandler); @@ -1197,8 +1196,7 @@ xml_ereport(int level, int sqlcode, if (xml_err_buf->len > 0) { detail = pstrdup(xml_err_buf->data); - xml_err_buf->data[0] = '\0'; - xml_err_buf->len = 0; + resetStringInfo(xml_err_buf); } else detail = NULL; |
