mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
where you state a format and arguments. the old behavior required each appendStringInfo to have to have a sprintf() before it if any formatting was required. Also shortened several instances where there were multiple appendStringInfo() calls in a row, doing nothing more then adding one more word to the String, instead of doing them all in one call.
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* stringinfo.h--
|
|
* Declarations/definitons for "string" functions.
|
|
*
|
|
*
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $Id: stringinfo.h,v 1.8 1998/12/14 08:11:17 scrappy Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef STRINGINFO_H
|
|
#define STRINGINFO_H
|
|
|
|
|
|
/*-------------------------
|
|
* StringInfoData holds information about a string.
|
|
* 'data' is the string.
|
|
* 'len' is the current string length (as returned by 'strlen')
|
|
* 'maxlen' is the size in bytes of 'data', i.e. the maximum string
|
|
* size (including the terminating '\0' char) that we can
|
|
* currently store in 'data' without having to reallocate
|
|
* more space.
|
|
*/
|
|
typedef struct StringInfoData
|
|
{
|
|
char *data;
|
|
int maxlen;
|
|
int len;
|
|
} StringInfoData;
|
|
|
|
typedef StringInfoData *StringInfo;
|
|
|
|
/*------------------------
|
|
* makeStringInfo
|
|
* create a 'StringInfoData' & return a pointer to it.
|
|
*/
|
|
extern StringInfo makeStringInfo(void);
|
|
|
|
/*------------------------
|
|
* appendStringInfo
|
|
* similar to 'strcat' but reallocates more space if necessary...
|
|
*/
|
|
extern void appendStringInfo(StringInfo str, const char *fmt,...);
|
|
|
|
#endif /* STRINGINFO_H */
|