summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2000-01-22 03:52:04 +0000
committerTom Lane2000-01-22 03:52:04 +0000
commit5c33b3c65819df7868e7b69378621d6924a11915 (patch)
tree313a3a48ad513fcc83aa9046e4ec22c6727ea630 /src/include
parentd32cd1bb2540d4e8310edf5bf8b13be793a4da38 (diff)
Change a few routines into macros to improve speed of COPY IN inner loop.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/lib/stringinfo.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/include/lib/stringinfo.h b/src/include/lib/stringinfo.h
index afdad2f8d32..03fc88accc5 100644
--- a/src/include/lib/stringinfo.h
+++ b/src/include/lib/stringinfo.h
@@ -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 $
*
*-------------------------------------------------------------------------
*/
@@ -90,11 +90,21 @@ 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 */