Index: src/backend/lib/stringinfo.c
===================================================================
RCS file: /home/neilc/postgres/cvs_root/pgsql/src/backend/lib/stringinfo.c,v
retrieving revision 1.44
diff -c -p -r1.44 stringinfo.c
*** src/backend/lib/stringinfo.c	5 Jan 2007 22:19:29 -0000	1.44
--- src/backend/lib/stringinfo.c	3 Mar 2007 06:51:47 -0000
*************** initStringInfo(StringInfo str)
*** 49,56 ****
  
  	str->data = (char *) palloc(size);
  	str->maxlen = size;
! 	str->len = 0;
  	str->data[0] = '\0';
  	str->cursor = 0;
  }
  
--- 49,68 ----
  
  	str->data = (char *) palloc(size);
  	str->maxlen = size;
! 	resetStringInfo(str);
! }
! 
! /*
!  * resetStringInfo
!  *
!  * Reset the StringInfo: the data buffer remains valid, but its
!  * previous content, if any, is cleared.
!  */
! void
! resetStringInfo(StringInfo str)
! {
  	str->data[0] = '\0';
+ 	str->len = 0;
  	str->cursor = 0;
  }
  
Index: src/include/lib/stringinfo.h
===================================================================
RCS file: /home/neilc/postgres/cvs_root/pgsql/src/include/lib/stringinfo.h,v
retrieving revision 1.33
diff -c -p -r1.33 stringinfo.h
*** src/include/lib/stringinfo.h	5 Jan 2007 22:19:55 -0000	1.33
--- src/include/lib/stringinfo.h	3 Mar 2007 06:51:12 -0000
*************** extern StringInfo makeStringInfo(void);
*** 79,84 ****
--- 79,91 ----
  extern void initStringInfo(StringInfo str);
  
  /*------------------------
+  * resetStringInfo
+  * Clears the current content of the StringInfo, if any. The
+  * StringInfo remains valid.
+  */
+ extern void resetStringInfo(StringInfo str);
+ 
+ /*------------------------
   * appendStringInfo
   * Format text data under the control of fmt (an sprintf-style format string)
   * and append it to whatever is already in str.  More space is allocated
