aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2019-07-23 00:14:11 +1200
committerDavid Rowley <drowley@postgresql.org>2019-07-23 00:14:11 +1200
commit1e6a759838f7c104f3cd1fe6981a98780da4131b (patch)
tree47047d8991d0918b531fe71f38b637dc086c9ffa /src/backend/utils/adt/ruleutils.c
parent19781729f789f3c6b2540e02b96f8aa500460322 (diff)
downloadpostgresql-1e6a759838f7c104f3cd1fe6981a98780da4131b.tar.gz
postgresql-1e6a759838f7c104f3cd1fe6981a98780da4131b.zip
Use appendBinaryStringInfo in more places where the length is known
When we already know the length that we're going to append, then it makes sense to use appendBinaryStringInfo instead of appendStringInfoString so that the append can be performed with a simple memcpy() using a known length rather than having to first perform a strlen() call to obtain the length. Discussion: https://postgr.es/m/CAKJS1f8+FRAM1s5+mAa3isajeEoAaicJ=4e0WzrH3tAusbbiMQ@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 4ca0ed2bbbd..0c58f1f1096 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -2804,9 +2804,9 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
appendStringInfoChar(&dq, 'x');
appendStringInfoChar(&dq, '$');
- appendStringInfoString(&buf, dq.data);
+ appendBinaryStringInfo(&buf, dq.data, dq.len);
appendStringInfoString(&buf, prosrc);
- appendStringInfoString(&buf, dq.data);
+ appendBinaryStringInfo(&buf, dq.data, dq.len);
appendStringInfoChar(&buf, '\n');
@@ -2930,7 +2930,7 @@ print_function_rettype(StringInfo buf, HeapTuple proctup)
appendStringInfoString(&rbuf, format_type_be(proc->prorettype));
}
- appendStringInfoString(buf, rbuf.data);
+ appendBinaryStringInfo(buf, rbuf.data, rbuf.len);
}
/*
@@ -5682,7 +5682,7 @@ get_target_list(List *targetList, deparse_context *context,
}
/* Add the new field */
- appendStringInfoString(buf, targetbuf.data);
+ appendBinaryStringInfo(buf, targetbuf.data, targetbuf.len);
}
/* clean up */
@@ -9987,7 +9987,7 @@ get_from_clause(Query *query, const char *prefix, deparse_context *context)
}
/* Add the new item */
- appendStringInfoString(buf, itembuf.data);
+ appendBinaryStringInfo(buf, itembuf.data, itembuf.len);
/* clean up */
pfree(itembuf.data);