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/xml.c | |
parent | 053981f4054f6dfcda0ce65566605b49ca366a97 (diff) | |
download | postgresql-90d76525c5cc2f3f4781351a1d99be839dfa2874.tar.gz postgresql-90d76525c5cc2f3f4781351a1d99be839dfa2874.zip |
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/xml.c')
-rw-r--r-- | src/backend/utils/adt/xml.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 547d98df1e6..921fe1d9f50 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; |