v3-0002-reduce-overhead-strlen-in-ReplicationSlotValidateName.patch
text/x-patch
Filename: v3-0002-reduce-overhead-strlen-in-ReplicationSlotValidateName.patch
Type: text/x-patch
Part: 1
Patch
Format: unified
Series: patch v3-0002
| File | + | − |
|---|---|---|
| src/backend/replication/slot.c | 3 | 2 |
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 8c18b4ed05..b01d9d3999 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -172,8 +172,9 @@ bool
ReplicationSlotValidateName(const char *name, int elevel)
{
const char *cp;
+ int len = strlen(name);
- if (strlen(name) == 0)
+ if (len == 0)
{
ereport(elevel,
(errcode(ERRCODE_INVALID_NAME),
@@ -182,7 +183,7 @@ ReplicationSlotValidateName(const char *name, int elevel)
return false;
}
- if (strlen(name) >= NAMEDATALEN)
+ if (len >= NAMEDATALEN)
{
ereport(elevel,
(errcode(ERRCODE_NAME_TOO_LONG),