1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-16 16:42:29 +03:00

Change a few routines into macros to improve speed of COPY IN inner loop.

This commit is contained in:
Tom Lane
2000-01-22 03:52:04 +00:00
parent d32cd1bb25
commit 5c33b3c658
2 changed files with 32 additions and 35 deletions

View File

@@ -9,7 +9,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: stringinfo.h,v 1.14 1999/08/31 01:28:21 tgl Exp $
* $Id: stringinfo.h,v 1.15 2000/01/22 03:52:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -89,12 +89,22 @@ extern void appendStringInfo(StringInfo str, const char *fmt,...);
*/
extern void appendStringInfoChar(StringInfo str, char ch);
/*------------------------
* appendStringInfoCharMacro
* As above, but a macro for even more speed where it matters.
* Caution: str argument will be evaluated multiple times.
*/
#define appendStringInfoCharMacro(str,ch) \
(((str)->len + 1 >= (str)->maxlen) ? \
appendStringInfoChar(str, ch) : \
((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0'))
/*------------------------
* appendBinaryStringInfo
* Append arbitrary binary data to a StringInfo, allocating more space
* if necessary.
*/
extern void appendBinaryStringInfo(StringInfo str,
const char *data, int datalen);
const char *data, int datalen);
#endif /* STRINGINFO_H */