v18-0005-Do-1-byte-ascii-check-if-8-byte-check-fails.patch
application/octet-stream
Filename: v18-0005-Do-1-byte-ascii-check-if-8-byte-check-fails.patch
Type: application/octet-stream
Part: 4
Message:
Re: speed up verifying UTF-8
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v18-0005
Subject: Do 1-byte ascii check if 8-byte check fails
| File | + | − |
|---|---|---|
| src/common/wchar.c | 8 | 0 |
From 3ff5679947ebde4938998bc5742c8a5d8343de67 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@2ndquadrant.com>
Date: Sun, 18 Jul 2021 19:28:57 -0400
Subject: [PATCH v18 5/6] Do 1-byte ascii check if 8-byte check fails
---
src/common/wchar.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/common/wchar.c b/src/common/wchar.c
index bba54912f9..465efd2e0d 100644
--- a/src/common/wchar.c
+++ b/src/common/wchar.c
@@ -1992,6 +1992,14 @@ pg_utf8_verifystr(const unsigned char *s, int len)
continue;
}
+ /* check if the first byte is both non-zero and doesn't have the high bit set */
+ if ((signed char) (*s) > 0)
+ {
+ s++;
+ len--;
+ continue;
+ }
+
/*
* Found non-ASCII or zero above, so verify a single character.
*/
--
2.31.1