aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2025-01-09 14:48:07 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2025-01-09 15:34:05 +0300
commit99679ceb52dc0e5ed023f32855dd9854dfa90ac8 (patch)
tree95ac959195008c0d950b9257652e5748d8f933cc /contrib
parentef8c4a245b37b3224dede06631ac95e4a1b3f9e6 (diff)
downloadydb-99679ceb52dc0e5ed023f32855dd9854dfa90ac8.tar.gz
Update contrib/libs/nghttp3 to 1.7.0
commit_hash:c10153839fd4ce0867242e0d90f204db6b9b64c1
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libs/nghttp3/.yandex_meta/__init__.py24
-rw-r--r--contrib/libs/nghttp3/.yandex_meta/devtools.copyrights.report4
-rw-r--r--contrib/libs/nghttp3/.yandex_meta/devtools.licenses.report4
-rw-r--r--contrib/libs/nghttp3/.yandex_meta/override.nix4
-rw-r--r--contrib/libs/nghttp3/ChangeLog416
-rw-r--r--contrib/libs/nghttp3/lib/includes/nghttp3/version.h4
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_conn.c2
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_conn.h2
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_gaptr.c16
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_http.c19
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_ksl.c75
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_ksl.h109
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_macro.h36
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_qpack.c9
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_ringbuf.c16
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_stream.c2
-rw-r--r--contrib/libs/nghttp3/lib/nghttp3_stream.h2
-rw-r--r--contrib/libs/nghttp3/lib/sfparse/sfparse.c654
-rw-r--r--contrib/libs/nghttp3/lib/sfparse/sfparse.h312
-rw-r--r--contrib/libs/nghttp3/patches/include.patch5
-rw-r--r--contrib/libs/nghttp3/patches/staticlib.patch8
-rw-r--r--contrib/libs/nghttp3/ya.make10
22 files changed, 851 insertions, 882 deletions
diff --git a/contrib/libs/nghttp3/.yandex_meta/__init__.py b/contrib/libs/nghttp3/.yandex_meta/__init__.py
index 344c3f236e..3f47c6a146 100644
--- a/contrib/libs/nghttp3/.yandex_meta/__init__.py
+++ b/contrib/libs/nghttp3/.yandex_meta/__init__.py
@@ -1,25 +1,10 @@
-import os
from devtools.yamaker.project import CMakeNinjaNixProject
def post_install(self):
- includeFilePath = os.path.join(self.dstdir, "lib/includes/nghttp3/nghttp3.h")
-
- with open(includeFilePath, "r") as file:
- filedata = file.read()
-
- filedata = filedata.replace("<nghttp3/version.h>", '"version.h"')
-
- with open(includeFilePath, "w") as file:
- file.write(filedata)
-
- # Add PEERDIR to contrib/libs/nghttp2 and remove sfparse.c from SRCS
- # because nghttp2 already has sfparse.c.
- # Using sfparse.c from nghttp3 may cause a linker error in projects
- # that use nghttp2 and nghttp3 when building with the flag -all_load
+ # Prefix sfparse_parser_dict to avoid conflicts with nghttp2 which also bundles sfparse library
with self.yamakes["."] as m:
- m.PEERDIR.add("contrib/libs/nghttp2")
- m.SRCS.remove("lib/sfparse/sfparse.c")
+ m.CFLAGS.append("-Dsfparse_parser_dict=nghttp3_sfparse_parser_dict")
nghttp3 = CMakeNinjaNixProject(
@@ -32,3 +17,8 @@ nghttp3 = CMakeNinjaNixProject(
platform_dispatchers=["config.h"],
addincl_global={".": {"./lib/includes"}},
)
+
+nghttp3.copy_top_sources_except |= {
+ # This is just a git log, ignore it
+ "ChangeLog",
+}
diff --git a/contrib/libs/nghttp3/.yandex_meta/devtools.copyrights.report b/contrib/libs/nghttp3/.yandex_meta/devtools.copyrights.report
index fb16c9775b..e0698d2f92 100644
--- a/contrib/libs/nghttp3/.yandex_meta/devtools.copyrights.report
+++ b/contrib/libs/nghttp3/.yandex_meta/devtools.copyrights.report
@@ -57,7 +57,7 @@ BELONGS ya.make
Score : 100.00
Match type : COPYRIGHT
Files with this license:
- lib/sfparse/sfparse.c [792:792]
+ lib/sfparse/sfparse.c [1060:1060]
KEEP COPYRIGHT_SERVICE_LABEL 1c2050c8044ca0184cd622399091074c
BELONGS ya.make
@@ -84,7 +84,7 @@ BELONGS ya.make
Score : 100.00
Match type : COPYRIGHT
Files with this license:
- lib/sfparse/sfparse.c [789:790]
+ lib/sfparse/sfparse.c [1057:1058]
KEEP COPYRIGHT_SERVICE_LABEL 3782c9399af9718cb85783105b7784ae
BELONGS ya.make
diff --git a/contrib/libs/nghttp3/.yandex_meta/devtools.licenses.report b/contrib/libs/nghttp3/.yandex_meta/devtools.licenses.report
index ac35088168..2bdd81ce7a 100644
--- a/contrib/libs/nghttp3/.yandex_meta/devtools.licenses.report
+++ b/contrib/libs/nghttp3/.yandex_meta/devtools.licenses.report
@@ -156,7 +156,7 @@ BELONGS ya.make
KEEP MIT f759889bc387afe17a80ab852d7af858
BELONGS ya.make
-FILE_INCLUDE AUTHORS found in files: lib/sfparse/sfparse.c at line 808
+FILE_INCLUDE AUTHORS found in files: lib/sfparse/sfparse.c at line 1076
Note: matched license text is too long. Read it in the source files.
Scancode info:
Original SPDX id: MIT
@@ -164,4 +164,4 @@ FILE_INCLUDE AUTHORS found in files: lib/sfparse/sfparse.c at line 808
Match type : TEXT
Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT
Files with this license:
- lib/sfparse/sfparse.c [794:812]
+ lib/sfparse/sfparse.c [1062:1080]
diff --git a/contrib/libs/nghttp3/.yandex_meta/override.nix b/contrib/libs/nghttp3/.yandex_meta/override.nix
index 5bec6bee15..393816b678 100644
--- a/contrib/libs/nghttp3/.yandex_meta/override.nix
+++ b/contrib/libs/nghttp3/.yandex_meta/override.nix
@@ -1,6 +1,6 @@
pkgs: attrs: with pkgs; with attrs; rec {
pname = "nghttp3";
- version = "1.6.0";
+ version = "1.7.0";
nativeBuildInputs = [
cmake pkg-config autoconf libtool automake
@@ -10,6 +10,6 @@ pkgs: attrs: with pkgs; with attrs; rec {
src = fetchurl {
url = "https://github.com/ngtcp2/nghttp3/releases/download/v${version}/nghttp3-${version}.tar.xz";
- hash = "sha256-6qkBlUvElANNNzjvGRMN5pOH1qPaApBExg2drpF5Ko0=";
+ hash = "sha256-tOtrzrmSk9mp3yAxwarRZq89V7PjNlWsoGmTl7bw11E=";
};
}
diff --git a/contrib/libs/nghttp3/ChangeLog b/contrib/libs/nghttp3/ChangeLog
deleted file mode 100644
index 84280d2a91..0000000000
--- a/contrib/libs/nghttp3/ChangeLog
+++ /dev/null
@@ -1,416 +0,0 @@
-commit e79890583f1ba8bb4d58d7456043a7e65205b34d
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-05
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-05
-
- Bump package and library versions
-
-commit 54cfefe9c32387f1085766f60520bc458f7f374d
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-05
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-05
-
- Update AUTHORS
-
-commit 107aef87ce82eacab564b10eb1eead752bde1507
-Merge: 6e1a15d 0758422
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-10-03
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-10-03
-
- Merge pull request #267 from ngtcp2/check-header-value-avx2
-
- Optimize nghttp3_check_header_value
-
-commit 6e1a15d42d8484425bf29744aaeef6631c8873f5
-Merge: ade24b7 94fce2e
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-10-02
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-10-02
-
- Merge pull request #268 from ngtcp2/cmake-remove-trailing-ws
-
- cmake: Remove trailing spaces
-
-commit 94fce2ec75fa9eb27144590ece9006da5541db9c
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-02
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-02
-
- cmake: Remove trailing spaces
-
-commit 07584226aa11a92f78072a4925d3eac81e4bd19c
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-01
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-01
-
- Optimize nghttp3_check_header_value
-
- Optimize nghttp3_check_header_value with AVX2 instructions if
- available.
-
-commit ade24b7f2da755485149ebca0340264b99abae8d
-Merge: bdfd99f f808f05
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-10-01
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-10-01
-
- Merge pull request #266 from ngtcp2/revert-265
-
- Revert "Optimize nghttp3_check_header_value"
-
-commit f808f05439ad903034e30d05ee7f0023ad12fb48
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-01
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-01
-
- Revert "Optimize nghttp3_check_header_value"
-
- This reverts commit 21c3e2ffaeda7d2f69f9718945c79b846e6443d2.
-
-commit bdfd99f2f41805c4a9513e523019c9e3c9b1d17d
-Merge: d602bd1 21c3e2f
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-30
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-30
-
- Merge pull request #265 from ngtcp2/check-header-value-sse42
-
- Optimize nghttp3_check_header_value
-
-commit d602bd1ab20b49066614779dc272996c184abce7
-Merge: 68bc239 8fd4bd8
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-30
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-30
-
- Merge pull request #264 from ngtcp2/limit-huffman-decode
-
- Do huffman encoding only when the reduction is more than 25%
-
-commit 21c3e2ffaeda7d2f69f9718945c79b846e6443d2
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-29
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-30
-
- Optimize nghttp3_check_header_value
-
- Optimize nghttp3_check_header_value with SSE4.2 instructions if
- available.
-
-commit 8fd4bd833e764f5b0d46f7b8ed2ae2708cafbfd1
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-29
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-29
-
- Do huffman encoding only when the reduction is more than 25%
-
- Do huffman encoding only when the reduction is more than 25% because
- huffman decoding is quite costly for relatively large field values.
-
-commit 68bc239d34c1ee43647993c722e3db8bdbc1238f
-Merge: 0889971 76c42e2
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-29
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-29
-
- Merge pull request #263 from ngtcp2/qpack-opcode-switch
-
- qpack: Switch on opcode
-
-commit 76c42e277f6ff2062a9311e2fd11653c28f0e97b
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-27
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-27
-
- qpack: Switch on opcode
-
-commit 0889971045eb3f2199c3763599227a0a256a018e
-Merge: 02ea26c 4ff70b1
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-25
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-25
-
- Merge pull request #262 from ngtcp2/simplify-http-on-req-resp-header
-
- Simplify http_request_on_header and http_response_on_header
-
-commit 4ff70b1254296800dc8387862e49b51091ce23b9
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-25
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-25
-
- Simplify http_request_on_header and http_response_on_header
-
-commit 02ea26c95bcd40b06734ad01e77033f9be4e30c5
-Merge: ccbc5dd 1199810
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-25
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-25
-
- Merge pull request #261 from ngtcp2/refactor-http-on-header
-
- Refactor http on header
-
-commit 1199810f2bf48279759e86edabfd99b2cc3b165f
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-24
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-25
-
- Add gennmchartbl.py
-
-commit 3e53cbbd1b1785187d896085480582906d69a00e
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-24
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-25
-
- Refactor nghttp3_http_on_header
-
- Rearrange switch statements so that token switch is done just once.
- Apply some optimisations by removing unneeded lines of code and
- conditionals.
-
-commit ccbc5ddd25a2bca46e120131f84aa6f59c4ba93d
-Merge: 3e14e6f 8ff5d34
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-19
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-19
-
- Merge pull request #260 from ngtcp2/ispow2
-
- ispow2: Better fallback implementation
-
-commit 8ff5d342097a164780e9b0388e82a7c6e78773ae
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-19
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-19
-
- ispow2: Better fallback implementation
-
-commit 3e14e6f020c4105d8358189e767a8c570f9612b0
-Merge: a872b6c c6669de
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-14
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-14
-
- Merge pull request #259 from ngtcp2/clang-format-fuzz
-
- clang-format files under fuzz
-
-commit c6669deacd8bbe39e842f8d415bf2caf9d460e22
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-14
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-14
-
- clang-format files under fuzz
-
-commit a872b6ca8a1fef513e8f4b2d50ebc0dd4906879e
-Merge: b970523 8511829
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-14
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-14
-
- Merge pull request #258 from ngtcp2/macro-comments
-
- Consistent macro comments
-
-commit 85118298ee2051508809f48bba06a997b62c63e5
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-14
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-14
-
- Consistent macro comments
-
- Make macro comments consistent throughout the codebase. Fixup
- HAVE_BE64TOH and HAVE_BSWAP_64 cmakedefine to match the semantics of
- autotools. Fix nghttp3_ntohl64 and nghttp3_htonl64 for bigendian in
- examples.
-
-commit b9705237a948c2ee7ea239b2392b13db7c85ceca
-Merge: 31a1543 c75f960
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-11
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-11
-
- Merge pull request #256 from ngtcp2/optimize-read-varint
-
- Optimize nghttp3_read_varint
-
-commit c75f960a12d4c9914987f328b3cf98661202164a
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-11
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-11
-
- Optimize nghttp3_read_varint
-
-commit 31a1543276ecb7fcab2b16b8ba2655e478e5d2b4
-Merge: 7473d2f a0e5fb0
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-10
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-10
-
- Merge pull request #255 from ngtcp2/map-update
-
- nghttp3_map: Port ngtcp2 changes
-
-commit a0e5fb0bc3f11faf493ce0e50294e38b43b37aa4
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-10
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-10
-
- nghttp3_map: Port ngtcp2 changes
-
-commit 7473d2f0aa6a2edd15be3e06fcecdac576a9fab0
-Merge: 99ba689 8a8d45c
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-04
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-04
-
- Merge pull request #254 from ngtcp2/amend-253
-
- Fix potential overflow
-
-commit 8a8d45cb734eb8087773988cafee3a15906e7f52
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-04
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-04
-
- Fix potential overflow
-
-commit 99ba6896a219cdd85c29e20068c7a3b946d4c57f
-Merge: 2c4a381 b8c6cca
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-09-04
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-09-04
-
- Merge pull request #253 from ngtcp2/qpack-buf-reserve
-
- Refactor qpack reserve_buf
-
-commit b8c6cca46afac0ca60e927377cc6831de76e76f1
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-09-04
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-09-04
-
- Refactor qpack reserve_buf
-
- Previously, reserve_buf_small and reserve_buf were doing the same
- thing. Remove them and call reserve_buf_internal directly. Optimize
- the code to round up to the next highest power of 2.
-
-commit 2c4a3816bbeab45e7c9092aecc915b54a3c88ccb
-Merge: e9f34d9 f4d323a
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-08-31
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-08-31
-
- Merge pull request #252 from fcharlie/arm-intrinsics
-
- Fix ARM64 __popcnt intrinsics
-
-commit f4d323ad0a2d5ac8a6445cb7b06e3efa95d19f39
-Author: Force Charlie <charlieio@outlook.com>
-AuthorDate: 2024-08-30
-Commit: Force Charlie <charlieio@outlook.com>
-CommitDate: 2024-08-30
-
- Fix ARM64 __popcnt intrinsics
-
-commit e9f34d95a81b2792605f7d8c78dd30c9112d3d04
-Merge: 32a66a3 a9e8cd5
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-08-30
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-08-30
-
- Merge pull request #250 from talregev/TalR/fix_include_export
-
- Fix include export
-
-commit a9e8cd5d9ac82b9e4385cdfdec0d0e231b22f662
-Author: Tal Regev <tal.regev@gmail.com>
-AuthorDate: 2024-08-30
-Commit: Tal Regev <tal.regev@gmail.com>
-CommitDate: 2024-08-30
-
- Fix include export
-
-commit 32a66a3fe442835568072a0f0d78ad1a54bb882a
-Merge: 8067396 c7bd7f3
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-08-28
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-08-28
-
- Merge pull request #248 from talregev/TalR/cmake_export
-
- Fix cmake export
-
-commit c7bd7f3666babf7ed4cd411120031d78c53810e8
-Author: Tal Regev <tal.regev@gmail.com>
-AuthorDate: 2024-08-28
-Commit: Tal Regev <tal.regev@gmail.com>
-CommitDate: 2024-08-28
-
- Fix cmake export
-
-commit 806739676fcf0ba61f94c23e4b35567f697ee013
-Merge: 3c7c7f2 96737c0
-Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
-AuthorDate: 2024-08-28
-Commit: GitHub <noreply@github.com>
-CommitDate: 2024-08-28
-
- Merge pull request #249 from ngtcp2/change-clang-format-options
-
- Change clang-format options
-
-commit 96737c00a942d0911f59fa7265954b08f0e09114
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-08-28
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-08-28
-
- Change clang-format options
-
-commit 3c7c7f29b1eba52363fe01907d796b96b38a0ee8
-Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-08-24
-Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-08-24
-
- Bump package version
diff --git a/contrib/libs/nghttp3/lib/includes/nghttp3/version.h b/contrib/libs/nghttp3/lib/includes/nghttp3/version.h
index 7f6cb8acff..0288e9a15b 100644
--- a/contrib/libs/nghttp3/lib/includes/nghttp3/version.h
+++ b/contrib/libs/nghttp3/lib/includes/nghttp3/version.h
@@ -31,7 +31,7 @@
*
* Version number of the nghttp3 library release.
*/
-#define NGHTTP3_VERSION "1.6.0"
+#define NGHTTP3_VERSION "1.7.0"
/**
* @macro
@@ -41,6 +41,6 @@
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
-#define NGHTTP3_VERSION_NUM 0x010600
+#define NGHTTP3_VERSION_NUM 0x010700
#endif /* !defined(NGHTTP3_VERSION_H) */
diff --git a/contrib/libs/nghttp3/lib/nghttp3_conn.c b/contrib/libs/nghttp3/lib/nghttp3_conn.c
index f70b4f5472..0cf9f7eaf1 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_conn.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_conn.c
@@ -39,7 +39,7 @@
dynamic table capacity that QPACK encoder is willing to use. */
#define NGHTTP3_QPACK_ENCODER_MAX_DTABLE_CAPACITY 4096
-nghttp3_objalloc_def(chunk, nghttp3_chunk, oplent);
+nghttp3_objalloc_def(chunk, nghttp3_chunk, oplent)
/*
* conn_remote_stream_uni returns nonzero if |stream_id| is remote
diff --git a/contrib/libs/nghttp3/lib/nghttp3_conn.h b/contrib/libs/nghttp3/lib/nghttp3_conn.h
index 1218ba508b..3ab6d34422 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_conn.h
+++ b/contrib/libs/nghttp3/lib/nghttp3_conn.h
@@ -76,7 +76,7 @@ typedef struct nghttp3_chunk {
nghttp3_opl_entry oplent;
} nghttp3_chunk;
-nghttp3_objalloc_decl(chunk, nghttp3_chunk, oplent);
+nghttp3_objalloc_decl(chunk, nghttp3_chunk, oplent)
struct nghttp3_conn {
nghttp3_objalloc out_chunk_objalloc;
diff --git a/contrib/libs/nghttp3/lib/nghttp3_gaptr.c b/contrib/libs/nghttp3/lib/nghttp3_gaptr.c
index 20eed5faa2..9ad12afecb 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_gaptr.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_gaptr.c
@@ -29,8 +29,8 @@
#include <assert.h>
void nghttp3_gaptr_init(nghttp3_gaptr *gaptr, const nghttp3_mem *mem) {
- nghttp3_ksl_init(&gaptr->gap, nghttp3_ksl_range_compar, sizeof(nghttp3_range),
- mem);
+ nghttp3_ksl_init(&gaptr->gap, nghttp3_ksl_range_compar,
+ nghttp3_ksl_range_search, sizeof(nghttp3_range), mem);
gaptr->mem = mem;
}
@@ -62,8 +62,8 @@ int nghttp3_gaptr_push(nghttp3_gaptr *gaptr, uint64_t offset,
}
}
- it = nghttp3_ksl_lower_bound_compar(&gaptr->gap, &q,
- nghttp3_ksl_range_exclusive_compar);
+ it = nghttp3_ksl_lower_bound_search(&gaptr->gap, &q,
+ nghttp3_ksl_range_exclusive_search);
for (; !nghttp3_ksl_it_end(&it);) {
k = *(nghttp3_range *)nghttp3_ksl_it_key(&it);
@@ -120,8 +120,8 @@ nghttp3_range nghttp3_gaptr_get_first_gap_after(nghttp3_gaptr *gaptr,
return r;
}
- it = nghttp3_ksl_lower_bound_compar(&gaptr->gap, &q,
- nghttp3_ksl_range_exclusive_compar);
+ it = nghttp3_ksl_lower_bound_search(&gaptr->gap, &q,
+ nghttp3_ksl_range_exclusive_search);
assert(!nghttp3_ksl_it_end(&it));
@@ -138,8 +138,8 @@ int nghttp3_gaptr_is_pushed(nghttp3_gaptr *gaptr, uint64_t offset,
return 0;
}
- it = nghttp3_ksl_lower_bound_compar(&gaptr->gap, &q,
- nghttp3_ksl_range_exclusive_compar);
+ it = nghttp3_ksl_lower_bound_search(&gaptr->gap, &q,
+ nghttp3_ksl_range_exclusive_search);
m = nghttp3_range_intersect(&q, (nghttp3_range *)nghttp3_ksl_it_key(&it));
return nghttp3_range_len(&m) == 0;
diff --git a/contrib/libs/nghttp3/lib/nghttp3_http.c b/contrib/libs/nghttp3/lib/nghttp3_http.c
index 38092cfb7c..be3dadfb45 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_http.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_http.c
@@ -124,17 +124,17 @@ static int is_ws(uint8_t c) {
int nghttp3_http_parse_priority(nghttp3_pri *dest, const uint8_t *value,
size_t valuelen) {
nghttp3_pri pri = *dest;
- sf_parser sfp;
- sf_vec key;
- sf_value val;
+ sfparse_parser sfp;
+ sfparse_vec key;
+ sfparse_value val;
int rv;
- sf_parser_init(&sfp, value, valuelen);
+ sfparse_parser_init(&sfp, value, valuelen);
for (;;) {
- rv = sf_parser_dict(&sfp, &key, &val);
+ rv = sfparse_parser_dict(&sfp, &key, &val);
if (rv != 0) {
- if (rv == SF_ERR_EOF) {
+ if (rv == SFPARSE_ERR_EOF) {
break;
}
@@ -147,7 +147,7 @@ int nghttp3_http_parse_priority(nghttp3_pri *dest, const uint8_t *value,
switch (key.base[0]) {
case 'i':
- if (val.type != SF_TYPE_BOOLEAN) {
+ if (val.type != SFPARSE_TYPE_BOOLEAN) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}
@@ -155,7 +155,8 @@ int nghttp3_http_parse_priority(nghttp3_pri *dest, const uint8_t *value,
break;
case 'u':
- if (val.type != SF_TYPE_INTEGER || val.integer < NGHTTP3_URGENCY_HIGH ||
+ if (val.type != SFPARSE_TYPE_INTEGER ||
+ val.integer < NGHTTP3_URGENCY_HIGH ||
NGHTTP3_URGENCY_LOW < val.integer) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}
@@ -197,7 +198,7 @@ static char VALID_AUTHORITY_CHARS[] = {
1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */,
1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */,
- 1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
+ 0 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */,
1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */,
1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,
diff --git a/contrib/libs/nghttp3/lib/nghttp3_ksl.c b/contrib/libs/nghttp3/lib/nghttp3_ksl.c
index a3b5fbcb05..f7bc6a3486 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_ksl.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_ksl.c
@@ -36,7 +36,7 @@
static nghttp3_ksl_blk null_blk = {{{NULL, NULL, 0, 0, {0}}}};
-nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent);
+nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
static size_t ksl_nodelen(size_t keylen) {
assert(keylen >= sizeof(uint64_t));
@@ -59,7 +59,8 @@ static void ksl_node_set_key(nghttp3_ksl *ksl, nghttp3_ksl_node *node,
}
void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
- size_t keylen, const nghttp3_mem *mem) {
+ nghttp3_ksl_search search, size_t keylen,
+ const nghttp3_mem *mem) {
size_t nodelen = ksl_nodelen(keylen);
nghttp3_objalloc_init(&ksl->blkalloc,
@@ -68,6 +69,7 @@ void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
ksl->head = NULL;
ksl->front = ksl->back = NULL;
ksl->compar = compar;
+ ksl->search = search;
ksl->n = 0;
ksl->keylen = keylen;
ksl->nodelen = nodelen;
@@ -274,20 +276,6 @@ static void ksl_insert_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i,
++blk->n;
}
-static size_t ksl_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
- const nghttp3_ksl_key *key,
- nghttp3_ksl_compar compar) {
- size_t i;
- nghttp3_ksl_node *node;
-
- for (i = 0, node = (nghttp3_ksl_node *)(void *)blk->nodes;
- i < blk->n && compar((nghttp3_ksl_key *)node->key, key);
- ++i, node = (nghttp3_ksl_node *)(void *)((uint8_t *)node + ksl->nodelen))
- ;
-
- return i;
-}
-
int nghttp3_ksl_insert(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
const nghttp3_ksl_key *key, void *data) {
nghttp3_ksl_blk *blk;
@@ -312,7 +300,7 @@ int nghttp3_ksl_insert(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
blk = ksl->head;
for (;;) {
- i = ksl_search(ksl, blk, key, ksl->compar);
+ i = ksl->search(ksl, blk, key);
if (blk->leaf) {
if (i < blk->n &&
@@ -571,7 +559,7 @@ int nghttp3_ksl_remove(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
}
for (;;) {
- i = ksl_search(ksl, blk, key, ksl->compar);
+ i = ksl->search(ksl, blk, key);
if (i == blk->n) {
if (it) {
@@ -642,12 +630,12 @@ int nghttp3_ksl_remove(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
nghttp3_ksl_it nghttp3_ksl_lower_bound(const nghttp3_ksl *ksl,
const nghttp3_ksl_key *key) {
- return nghttp3_ksl_lower_bound_compar(ksl, key, ksl->compar);
+ return nghttp3_ksl_lower_bound_search(ksl, key, ksl->search);
}
-nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
+nghttp3_ksl_it nghttp3_ksl_lower_bound_search(const nghttp3_ksl *ksl,
const nghttp3_ksl_key *key,
- nghttp3_ksl_compar compar) {
+ nghttp3_ksl_search search) {
nghttp3_ksl_blk *blk = ksl->head;
nghttp3_ksl_it it;
size_t i;
@@ -658,7 +646,7 @@ nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
}
for (;;) {
- i = ksl_search(ksl, blk, key, compar);
+ i = search(ksl, blk, key);
if (blk->leaf) {
if (i == blk->n && blk->next) {
@@ -702,7 +690,7 @@ void nghttp3_ksl_update_key(nghttp3_ksl *ksl, const nghttp3_ksl_key *old_key,
assert(ksl->head);
for (;;) {
- i = ksl_search(ksl, blk, old_key, ksl->compar);
+ i = ksl->search(ksl, blk, old_key);
assert(i < blk->n);
node = nghttp3_ksl_nth_node(ksl, blk, i);
@@ -825,9 +813,50 @@ int nghttp3_ksl_range_compar(const nghttp3_ksl_key *lhs,
return a->begin < b->begin;
}
+nghttp3_ksl_search_def(range, nghttp3_ksl_range_compar)
+
+size_t nghttp3_ksl_range_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key) {
+ return ksl_range_search(ksl, blk, key);
+}
+
int nghttp3_ksl_range_exclusive_compar(const nghttp3_ksl_key *lhs,
const nghttp3_ksl_key *rhs) {
const nghttp3_range *a = lhs, *b = rhs;
return a->begin < b->begin && !(nghttp3_max_uint64(a->begin, b->begin) <
nghttp3_min_uint64(a->end, b->end));
}
+
+nghttp3_ksl_search_def(range_exclusive, nghttp3_ksl_range_exclusive_compar)
+
+size_t nghttp3_ksl_range_exclusive_search(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key) {
+ return ksl_range_exclusive_search(ksl, blk, key);
+}
+
+int nghttp3_ksl_uint64_less(const nghttp3_ksl_key *lhs,
+ const nghttp3_ksl_key *rhs) {
+ return *(uint64_t *)lhs < *(uint64_t *)rhs;
+}
+
+nghttp3_ksl_search_def(uint64_less, nghttp3_ksl_uint64_less)
+
+size_t nghttp3_ksl_uint64_less_search(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key) {
+ return ksl_uint64_less_search(ksl, blk, key);
+}
+
+int nghttp3_ksl_int64_greater(const nghttp3_ksl_key *lhs,
+ const nghttp3_ksl_key *rhs) {
+ return *(int64_t *)lhs > *(int64_t *)rhs;
+}
+
+nghttp3_ksl_search_def(int64_greater, nghttp3_ksl_int64_greater)
+
+size_t nghttp3_ksl_int64_greater_search(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key) {
+ return ksl_int64_greater_search(ksl, blk, key);
+}
diff --git a/contrib/libs/nghttp3/lib/nghttp3_ksl.h b/contrib/libs/nghttp3/lib/nghttp3_ksl.h
index e15e227ce5..d0ce8cd664 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_ksl.h
+++ b/contrib/libs/nghttp3/lib/nghttp3_ksl.h
@@ -104,7 +104,7 @@ struct nghttp3_ksl_blk {
};
};
-nghttp3_objalloc_decl(ksl_blk, nghttp3_ksl_blk, oplent);
+nghttp3_objalloc_decl(ksl_blk, nghttp3_ksl_blk, oplent)
/*
* nghttp3_ksl_compar is a function type which returns nonzero if key
@@ -115,6 +115,35 @@ typedef int (*nghttp3_ksl_compar)(const nghttp3_ksl_key *lhs,
typedef struct nghttp3_ksl nghttp3_ksl;
+/*
+ * nghttp3_ksl_search is a function to search for the first element in
+ * |blk|->nodes which is not ordered before |key|. It returns the
+ * index of such element. It returns |blk|->n if there is no such
+ * element.
+ */
+typedef size_t (*nghttp3_ksl_search)(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key);
+
+/*
+ * nghttp3_ksl_search_def is a macro to implement nghttp3_ksl_search
+ * with COMPAR which is supposed to be nghttp3_ksl_compar.
+ */
+#define nghttp3_ksl_search_def(NAME, COMPAR) \
+ static size_t ksl_##NAME##_search(const nghttp3_ksl *ksl, \
+ nghttp3_ksl_blk *blk, \
+ const nghttp3_ksl_key *key) { \
+ size_t i; \
+ nghttp3_ksl_node *node; \
+ \
+ for (i = 0, node = (nghttp3_ksl_node *)(void *)blk->nodes; \
+ i < blk->n && COMPAR((nghttp3_ksl_key *)node->key, key); ++i, \
+ node = (nghttp3_ksl_node *)(void *)((uint8_t *)node + ksl->nodelen)) \
+ ; \
+ \
+ return i; \
+ }
+
typedef struct nghttp3_ksl_it nghttp3_ksl_it;
/*
@@ -138,6 +167,7 @@ struct nghttp3_ksl {
/* back points to the last leaf block. */
nghttp3_ksl_blk *back;
nghttp3_ksl_compar compar;
+ nghttp3_ksl_search search;
/* n is the number of elements stored. */
size_t n;
/* keylen is the size of key */
@@ -149,11 +179,13 @@ struct nghttp3_ksl {
/*
* nghttp3_ksl_init initializes |ksl|. |compar| specifies compare
- * function. |keylen| is the length of key and must be at least
+ * function. |search| is a search function which must use |compar|.
+ * |keylen| is the length of key and must be at least
* sizeof(uint64_t).
*/
void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
- size_t keylen, const nghttp3_mem *mem);
+ nghttp3_ksl_search search, size_t keylen,
+ const nghttp3_mem *mem);
/*
* nghttp3_ksl_free frees resources allocated for |ksl|. If |ksl| is
@@ -218,12 +250,12 @@ nghttp3_ksl_it nghttp3_ksl_lower_bound(const nghttp3_ksl *ksl,
const nghttp3_ksl_key *key);
/*
- * nghttp3_ksl_lower_bound_compar works like nghttp3_ksl_lower_bound,
- * but it takes custom function |compar| to do lower bound search.
+ * nghttp3_ksl_lower_bound_search works like nghttp3_ksl_lower_bound,
+ * but it takes custom function |search| to do lower bound search.
*/
-nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
+nghttp3_ksl_it nghttp3_ksl_lower_bound_search(const nghttp3_ksl *ksl,
const nghttp3_ksl_key *key,
- nghttp3_ksl_compar compar);
+ nghttp3_ksl_search search);
/*
* nghttp3_ksl_update_key replaces the key of nodes which has
@@ -330,22 +362,69 @@ int nghttp3_ksl_it_begin(const nghttp3_ksl_it *it);
/*
* nghttp3_ksl_range_compar is an implementation of
- * nghttp3_ksl_compar. lhs->ptr and rhs->ptr must point to
- * nghttp3_range object and the function returns nonzero if (const
- * nghttp3_range *)(lhs->ptr)->begin < (const nghttp3_range
- * *)(rhs->ptr)->begin.
+ * nghttp3_ksl_compar. |lhs| and |rhs| must point to nghttp3_range
+ * object, and the function returns nonzero if ((const nghttp3_range
+ * *)lhs)->begin < ((const nghttp3_range *)rhs)->begin.
*/
int nghttp3_ksl_range_compar(const nghttp3_ksl_key *lhs,
const nghttp3_ksl_key *rhs);
/*
+ * nghttp3_ksl_range_search is an implementation of nghttp3_ksl_search
+ * that uses nghttp3_ksl_range_compar.
+ */
+size_t nghttp3_ksl_range_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key);
+
+/*
* nghttp3_ksl_range_exclusive_compar is an implementation of
- * nghttp3_ksl_compar. lhs->ptr and rhs->ptr must point to
- * nghttp3_range object and the function returns nonzero if (const
- * nghttp3_range *)(lhs->ptr)->begin < (const nghttp3_range
- * *)(rhs->ptr)->begin and the 2 ranges do not intersect.
+ * nghttp3_ksl_compar. |lhs| and |rhs| must point to nghttp3_range
+ * object, and the function returns nonzero if ((const nghttp3_range
+ * *)lhs)->begin < ((const nghttp3_range *)rhs)->begin, and the 2
+ * ranges do not intersect.
*/
int nghttp3_ksl_range_exclusive_compar(const nghttp3_ksl_key *lhs,
const nghttp3_ksl_key *rhs);
+/*
+ * nghttp3_ksl_range_exclusive_search is an implementation of
+ * nghttp3_ksl_search that uses nghttp3_ksl_range_exclusive_compar.
+ */
+size_t nghttp3_ksl_range_exclusive_search(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key);
+
+/*
+ * nghttp3_ksl_uint64_less is an implementation of nghttp3_ksl_compar.
+ * |lhs| and |rhs| must point to uint64_t objects, and the function
+ * returns nonzero if *(uint64_t *)|lhs| < *(uint64_t *)|rhs|.
+ */
+int nghttp3_ksl_uint64_less(const nghttp3_ksl_key *lhs,
+ const nghttp3_ksl_key *rhs);
+
+/*
+ * nghttp3_ksl_uint64_less_search is an implementation of
+ * nghttp3_ksl_search that uses nghttp3_ksl_uint64_less.
+ */
+size_t nghttp3_ksl_uint64_less_search(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key);
+
+/*
+ * nghttp3_ksl_int64_greater is an implementation of
+ * nghttp3_ksl_compar. |lhs| and |rhs| must point to int64_t objects,
+ * and the function returns nonzero if *(int64_t *)|lhs| > *(int64_t
+ * *)|rhs|.
+ */
+int nghttp3_ksl_int64_greater(const nghttp3_ksl_key *lhs,
+ const nghttp3_ksl_key *rhs);
+
+/*
+ * nghttp3_ksl_int64_greater_search is an implementation of
+ * nghttp3_ksl_search that uses nghttp3_ksl_int64_greater.
+ */
+size_t nghttp3_ksl_int64_greater_search(const nghttp3_ksl *ksl,
+ nghttp3_ksl_blk *blk,
+ const nghttp3_ksl_key *key);
+
#endif /* !defined(NGHTTP3_KSL_H) */
diff --git a/contrib/libs/nghttp3/lib/nghttp3_macro.h b/contrib/libs/nghttp3/lib/nghttp3_macro.h
index a4e1dfea3c..ffe0ea7092 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_macro.h
+++ b/contrib/libs/nghttp3/lib/nghttp3_macro.h
@@ -48,27 +48,27 @@
#define nghttp3_max_def(SUFFIX, T) \
static inline T nghttp3_max_##SUFFIX(T a, T b) { return a < b ? b : a; }
-nghttp3_max_def(int8, int8_t);
-nghttp3_max_def(int16, int16_t);
-nghttp3_max_def(int32, int32_t);
-nghttp3_max_def(int64, int64_t);
-nghttp3_max_def(uint8, uint8_t);
-nghttp3_max_def(uint16, uint16_t);
-nghttp3_max_def(uint32, uint32_t);
-nghttp3_max_def(uint64, uint64_t);
-nghttp3_max_def(size, size_t);
+nghttp3_max_def(int8, int8_t)
+nghttp3_max_def(int16, int16_t)
+nghttp3_max_def(int32, int32_t)
+nghttp3_max_def(int64, int64_t)
+nghttp3_max_def(uint8, uint8_t)
+nghttp3_max_def(uint16, uint16_t)
+nghttp3_max_def(uint32, uint32_t)
+nghttp3_max_def(uint64, uint64_t)
+nghttp3_max_def(size, size_t)
#define nghttp3_min_def(SUFFIX, T) \
static inline T nghttp3_min_##SUFFIX(T a, T b) { return a < b ? a : b; }
-nghttp3_min_def(int8, int8_t);
-nghttp3_min_def(int16, int16_t);
-nghttp3_min_def(int32, int32_t);
-nghttp3_min_def(int64, int64_t);
-nghttp3_min_def(uint8, uint8_t);
-nghttp3_min_def(uint16, uint16_t);
-nghttp3_min_def(uint32, uint32_t);
-nghttp3_min_def(uint64, uint64_t);
-nghttp3_min_def(size, size_t);
+nghttp3_min_def(int8, int8_t)
+nghttp3_min_def(int16, int16_t)
+nghttp3_min_def(int32, int32_t)
+nghttp3_min_def(int64, int64_t)
+nghttp3_min_def(uint8, uint8_t)
+nghttp3_min_def(uint16, uint16_t)
+nghttp3_min_def(uint32, uint32_t)
+nghttp3_min_def(uint64, uint64_t)
+nghttp3_min_def(size, size_t)
#endif /* !defined(NGHTTP3_MACRO_H) */
diff --git a/contrib/libs/nghttp3/lib/nghttp3_qpack.c b/contrib/libs/nghttp3/lib/nghttp3_qpack.c
index a1c7e7487c..5dab00dcde 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_qpack.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_qpack.c
@@ -898,6 +898,8 @@ static int max_cnt_greater(const nghttp3_ksl_key *lhs,
return a->max_cnt > b->max_cnt || (a->max_cnt == b->max_cnt && a->id < b->id);
}
+nghttp3_ksl_search_def(max_cnt_greater, max_cnt_greater)
+
int nghttp3_qpack_encoder_init(nghttp3_qpack_encoder *encoder,
size_t hard_max_dtable_capacity,
const nghttp3_mem *mem) {
@@ -911,6 +913,7 @@ int nghttp3_qpack_encoder_init(nghttp3_qpack_encoder *encoder,
nghttp3_map_init(&encoder->streams, mem);
nghttp3_ksl_init(&encoder->blocked_streams, max_cnt_greater,
+ ksl_max_cnt_greater_search,
sizeof(nghttp3_blocked_streams_key), mem);
qpack_map_init(&encoder->dtable_map);
@@ -1834,7 +1837,7 @@ static int qpack_encoder_write_indexed_name(nghttp3_qpack_encoder *encoder,
int h = 0;
hlen = nghttp3_qpack_huffman_encode_count(nv->value, nv->valuelen);
- if (hlen * 4 < nv->valuelen * 3) {
+ if (hlen < nv->valuelen) {
h = 1;
len += nghttp3_qpack_put_varint_len(hlen, 7) + hlen;
} else {
@@ -1925,7 +1928,7 @@ static int qpack_encoder_write_literal(nghttp3_qpack_encoder *encoder,
int nh = 0, vh = 0;
nhlen = nghttp3_qpack_huffman_encode_count(nv->name, nv->namelen);
- if (nhlen * 4 < nv->namelen * 3) {
+ if (nhlen < nv->namelen) {
nh = 1;
len = nghttp3_qpack_put_varint_len(nhlen, prefix) + nhlen;
} else {
@@ -1933,7 +1936,7 @@ static int qpack_encoder_write_literal(nghttp3_qpack_encoder *encoder,
}
vhlen = nghttp3_qpack_huffman_encode_count(nv->value, nv->valuelen);
- if (vhlen * 4 < nv->valuelen * 3) {
+ if (vhlen < nv->valuelen) {
vh = 1;
len += nghttp3_qpack_put_varint_len(vhlen, 7) + vhlen;
} else {
diff --git a/contrib/libs/nghttp3/lib/nghttp3_ringbuf.c b/contrib/libs/nghttp3/lib/nghttp3_ringbuf.c
index 7d3ab39bf8..85c2e03f87 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_ringbuf.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_ringbuf.c
@@ -33,18 +33,20 @@
#include "nghttp3_macro.h"
+#ifndef NDEBUG
static int ispow2(size_t n) {
-#if defined(_MSC_VER) && !defined(__clang__) && \
- (defined(_M_ARM) || (defined(_M_ARM64) && _MSC_VER < 1941))
+# if defined(_MSC_VER) && !defined(__clang__) && \
+ (defined(_M_ARM) || (defined(_M_ARM64) && _MSC_VER < 1941))
return n && !(n & (n - 1));
-#elif defined(WIN32)
+# elif defined(WIN32)
return 1 == __popcnt((unsigned int)n);
-#else /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
- (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
+# else /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
+ (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
return 1 == __builtin_popcount((unsigned int)n);
-#endif /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
- (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
+# endif /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
+ (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
}
+#endif /* !defined(NDEBUG) */
int nghttp3_ringbuf_init(nghttp3_ringbuf *rb, size_t nmemb, size_t size,
const nghttp3_mem *mem) {
diff --git a/contrib/libs/nghttp3/lib/nghttp3_stream.c b/contrib/libs/nghttp3/lib/nghttp3_stream.c
index 328cddd488..4967f93c0d 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_stream.c
+++ b/contrib/libs/nghttp3/lib/nghttp3_stream.c
@@ -44,7 +44,7 @@
/* NGHTTP3_MIN_RBLEN is the minimum length of nghttp3_ringbuf */
#define NGHTTP3_MIN_RBLEN 4
-nghttp3_objalloc_def(stream, nghttp3_stream, oplent);
+nghttp3_objalloc_def(stream, nghttp3_stream, oplent)
int nghttp3_stream_new(nghttp3_stream **pstream, int64_t stream_id,
const nghttp3_stream_callbacks *callbacks,
diff --git a/contrib/libs/nghttp3/lib/nghttp3_stream.h b/contrib/libs/nghttp3/lib/nghttp3_stream.h
index 7d296febf9..9c0a18c5c0 100644
--- a/contrib/libs/nghttp3/lib/nghttp3_stream.h
+++ b/contrib/libs/nghttp3/lib/nghttp3_stream.h
@@ -255,7 +255,7 @@ struct nghttp3_stream {
};
};
-nghttp3_objalloc_decl(stream, nghttp3_stream, oplent);
+nghttp3_objalloc_decl(stream, nghttp3_stream, oplent)
typedef struct nghttp3_frame_entry {
nghttp3_frame fr;
diff --git a/contrib/libs/nghttp3/lib/sfparse/sfparse.c b/contrib/libs/nghttp3/lib/sfparse/sfparse.c
index d0328cf40c..cee089d394 100644
--- a/contrib/libs/nghttp3/lib/sfparse/sfparse.c
+++ b/contrib/libs/nghttp3/lib/sfparse/sfparse.c
@@ -30,38 +30,46 @@
#include <assert.h>
#include <stdlib.h>
-#define SF_STATE_DICT 0x08u
-#define SF_STATE_LIST 0x10u
-#define SF_STATE_ITEM 0x18u
+#ifdef __AVX2__
+# include <immintrin.h>
+#endif /* __AVX2__ */
-#define SF_STATE_INNER_LIST 0x04u
+#define SFPARSE_STATE_DICT 0x08u
+#define SFPARSE_STATE_LIST 0x10u
+#define SFPARSE_STATE_ITEM 0x18u
-#define SF_STATE_BEFORE 0x00u
-#define SF_STATE_BEFORE_PARAMS 0x01u
-#define SF_STATE_PARAMS 0x02u
-#define SF_STATE_AFTER 0x03u
+#define SFPARSE_STATE_INNER_LIST 0x04u
-#define SF_STATE_OP_MASK 0x03u
+#define SFPARSE_STATE_BEFORE 0x00u
+#define SFPARSE_STATE_BEFORE_PARAMS 0x01u
+#define SFPARSE_STATE_PARAMS 0x02u
+#define SFPARSE_STATE_AFTER 0x03u
-#define SF_SET_STATE_AFTER(NAME) (SF_STATE_##NAME | SF_STATE_AFTER)
-#define SF_SET_STATE_BEFORE_PARAMS(NAME) \
- (SF_STATE_##NAME | SF_STATE_BEFORE_PARAMS)
-#define SF_SET_STATE_INNER_LIST_BEFORE(NAME) \
- (SF_STATE_##NAME | SF_STATE_INNER_LIST | SF_STATE_BEFORE)
+#define SFPARSE_STATE_OP_MASK 0x03u
-#define SF_STATE_DICT_AFTER SF_SET_STATE_AFTER(DICT)
-#define SF_STATE_DICT_BEFORE_PARAMS SF_SET_STATE_BEFORE_PARAMS(DICT)
-#define SF_STATE_DICT_INNER_LIST_BEFORE SF_SET_STATE_INNER_LIST_BEFORE(DICT)
+#define SFPARSE_SET_STATE_AFTER(NAME) \
+ (SFPARSE_STATE_##NAME | SFPARSE_STATE_AFTER)
+#define SFPARSE_SET_STATE_BEFORE_PARAMS(NAME) \
+ (SFPARSE_STATE_##NAME | SFPARSE_STATE_BEFORE_PARAMS)
+#define SFPARSE_SET_STATE_INNER_LIST_BEFORE(NAME) \
+ (SFPARSE_STATE_##NAME | SFPARSE_STATE_INNER_LIST | SFPARSE_STATE_BEFORE)
-#define SF_STATE_LIST_AFTER SF_SET_STATE_AFTER(LIST)
-#define SF_STATE_LIST_BEFORE_PARAMS SF_SET_STATE_BEFORE_PARAMS(LIST)
-#define SF_STATE_LIST_INNER_LIST_BEFORE SF_SET_STATE_INNER_LIST_BEFORE(LIST)
+#define SFPARSE_STATE_DICT_AFTER SFPARSE_SET_STATE_AFTER(DICT)
+#define SFPARSE_STATE_DICT_BEFORE_PARAMS SFPARSE_SET_STATE_BEFORE_PARAMS(DICT)
+#define SFPARSE_STATE_DICT_INNER_LIST_BEFORE \
+ SFPARSE_SET_STATE_INNER_LIST_BEFORE(DICT)
-#define SF_STATE_ITEM_AFTER SF_SET_STATE_AFTER(ITEM)
-#define SF_STATE_ITEM_BEFORE_PARAMS SF_SET_STATE_BEFORE_PARAMS(ITEM)
-#define SF_STATE_ITEM_INNER_LIST_BEFORE SF_SET_STATE_INNER_LIST_BEFORE(ITEM)
+#define SFPARSE_STATE_LIST_AFTER SFPARSE_SET_STATE_AFTER(LIST)
+#define SFPARSE_STATE_LIST_BEFORE_PARAMS SFPARSE_SET_STATE_BEFORE_PARAMS(LIST)
+#define SFPARSE_STATE_LIST_INNER_LIST_BEFORE \
+ SFPARSE_SET_STATE_INNER_LIST_BEFORE(LIST)
-#define SF_STATE_INITIAL 0x00u
+#define SFPARSE_STATE_ITEM_AFTER SFPARSE_SET_STATE_AFTER(ITEM)
+#define SFPARSE_STATE_ITEM_BEFORE_PARAMS SFPARSE_SET_STATE_BEFORE_PARAMS(ITEM)
+#define SFPARSE_STATE_ITEM_INNER_LIST_BEFORE \
+ SFPARSE_SET_STATE_INNER_LIST_BEFORE(ITEM)
+
+#define SFPARSE_STATE_INITIAL 0x00u
#define DIGIT_CASES \
case '0': \
@@ -380,40 +388,108 @@ static int is_ws(uint8_t c) {
}
}
-static int parser_eof(sf_parser *sfp) { return sfp->pos == sfp->end; }
+#ifdef __AVX2__
+# ifdef _MSC_VER
+# include <intrin.h>
+
+static int ctz(unsigned int v) {
+ unsigned long n;
+
+ /* Assume that v is not 0. */
+ _BitScanForward(&n, v);
+
+ return (int)n;
+}
+# else /* !_MSC_VER */
+# define ctz __builtin_ctz
+# endif /* !_MSC_VER */
+#endif /* __AVX2__ */
+
+static int parser_eof(sfparse_parser *sfp) { return sfp->pos == sfp->end; }
-static void parser_discard_ows(sf_parser *sfp) {
+static void parser_discard_ows(sfparse_parser *sfp) {
for (; !parser_eof(sfp) && is_ws(*sfp->pos); ++sfp->pos)
;
}
-static void parser_discard_sp(sf_parser *sfp) {
+static void parser_discard_sp(sfparse_parser *sfp) {
for (; !parser_eof(sfp) && *sfp->pos == ' '; ++sfp->pos)
;
}
-static void parser_set_op_state(sf_parser *sfp, uint32_t op) {
- sfp->state &= ~SF_STATE_OP_MASK;
+static void parser_set_op_state(sfparse_parser *sfp, uint32_t op) {
+ sfp->state &= ~SFPARSE_STATE_OP_MASK;
sfp->state |= op;
}
-static void parser_unset_inner_list_state(sf_parser *sfp) {
- sfp->state &= ~SF_STATE_INNER_LIST;
+static void parser_unset_inner_list_state(sfparse_parser *sfp) {
+ sfp->state &= ~SFPARSE_STATE_INNER_LIST;
+}
+
+#ifdef __AVX2__
+static const uint8_t *find_char_key(const uint8_t *first, const uint8_t *last) {
+ const __m256i us = _mm256_set1_epi8('_');
+ const __m256i ds = _mm256_set1_epi8('-');
+ const __m256i dot = _mm256_set1_epi8('.');
+ const __m256i ast = _mm256_set1_epi8('*');
+ const __m256i r0l = _mm256_set1_epi8('0' - 1);
+ const __m256i r0r = _mm256_set1_epi8('9' + 1);
+ const __m256i r1l = _mm256_set1_epi8('a' - 1);
+ const __m256i r1r = _mm256_set1_epi8('z' + 1);
+ __m256i s, x;
+ uint32_t m;
+
+ for (; first != last; first += 32) {
+ s = _mm256_loadu_si256((void *)first);
+
+ x = _mm256_cmpeq_epi8(s, us);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, ds), x);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, dot), x);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, ast), x);
+ x = _mm256_or_si256(
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r0l), _mm256_cmpgt_epi8(r0r, s)),
+ x);
+ x = _mm256_or_si256(
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r1l), _mm256_cmpgt_epi8(r1r, s)),
+ x);
+
+ m = ~(uint32_t)_mm256_movemask_epi8(x);
+ if (m) {
+ return first + ctz(m);
+ }
+ }
+
+ return last;
}
+#endif /* __AVX2__ */
-static int parser_key(sf_parser *sfp, sf_vec *dest) {
+static int parser_key(sfparse_parser *sfp, sfparse_vec *dest) {
const uint8_t *base;
+#ifdef __AVX2__
+ const uint8_t *last;
+#endif /* __AVX2__ */
switch (*sfp->pos) {
case '*':
LCALPHA_CASES:
break;
default:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
base = sfp->pos++;
+#ifdef __AVX2__
+ if (sfp->end - sfp->pos >= 32) {
+ last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu);
+
+ sfp->pos = find_char_key(sfp->pos, last);
+ if (sfp->pos != last) {
+ goto fin;
+ }
+ }
+#endif /* __AVX2__ */
+
for (; !parser_eof(sfp); ++sfp->pos) {
switch (*sfp->pos) {
case '_':
@@ -428,6 +504,9 @@ static int parser_key(sf_parser *sfp, sf_vec *dest) {
break;
}
+#ifdef __AVX2__
+fin:
+#endif /* __AVX2__ */
if (dest) {
dest->base = (uint8_t *)base;
dest->len = (size_t)(sfp->pos - dest->base);
@@ -436,7 +515,7 @@ static int parser_key(sf_parser *sfp, sf_vec *dest) {
return 0;
}
-static int parser_number(sf_parser *sfp, sf_value *dest) {
+static int parser_number(sfparse_parser *sfp, sfparse_value *dest) {
int sign = 1;
int64_t value = 0;
size_t len = 0;
@@ -445,7 +524,7 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
if (*sfp->pos == '-') {
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
sign = -1;
@@ -457,7 +536,7 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
switch (*sfp->pos) {
DIGIT_CASES:
if (++len > 15) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
value *= 10;
@@ -470,13 +549,13 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
}
if (len == 0) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
if (parser_eof(sfp) || *sfp->pos != '.') {
if (dest) {
- dest->type = SF_TYPE_INTEGER;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_INTEGER;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->integer = value * sign;
}
@@ -486,7 +565,7 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
/* decimal */
if (len > 12) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
fpos = len;
@@ -497,7 +576,7 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
switch (*sfp->pos) {
DIGIT_CASES:
if (++len > 15) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
value *= 10;
@@ -510,12 +589,12 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
}
if (fpos == len || len - fpos > 3) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
if (dest) {
- dest->type = SF_TYPE_DECIMAL;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_DECIMAL;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->decimal.numer = value * sign;
switch (len - fpos) {
@@ -537,9 +616,9 @@ static int parser_number(sf_parser *sfp, sf_value *dest) {
return 0;
}
-static int parser_date(sf_parser *sfp, sf_value *dest) {
+static int parser_date(sfparse_parser *sfp, sfparse_value *dest) {
int rv;
- sf_value val;
+ sfparse_value val;
/* The first byte has already been validated by the caller. */
assert('@' == *sfp->pos);
@@ -547,7 +626,7 @@ static int parser_date(sf_parser *sfp, sf_value *dest) {
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
rv = parser_number(sfp, &val);
@@ -555,27 +634,93 @@ static int parser_date(sf_parser *sfp, sf_value *dest) {
return rv;
}
- if (val.type != SF_TYPE_INTEGER) {
- return SF_ERR_PARSE_ERROR;
+ if (val.type != SFPARSE_TYPE_INTEGER) {
+ return SFPARSE_ERR_PARSE;
}
if (dest) {
*dest = val;
- dest->type = SF_TYPE_DATE;
+ dest->type = SFPARSE_TYPE_DATE;
}
return 0;
}
-static int parser_string(sf_parser *sfp, sf_value *dest) {
+#ifdef __AVX2__
+static const uint8_t *find_char_string(const uint8_t *first,
+ const uint8_t *last) {
+ const __m256i bs = _mm256_set1_epi8('\\');
+ const __m256i dq = _mm256_set1_epi8('"');
+ const __m256i del = _mm256_set1_epi8(0x7f);
+ const __m256i sp = _mm256_set1_epi8(' ');
+ __m256i s, x;
+ uint32_t m;
+
+ for (; first != last; first += 32) {
+ s = _mm256_loadu_si256((void *)first);
+
+ x = _mm256_cmpgt_epi8(sp, s);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, bs), x);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, dq), x);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, del), x);
+
+ m = (uint32_t)_mm256_movemask_epi8(x);
+ if (m) {
+ return first + ctz(m);
+ }
+ }
+
+ return last;
+}
+#endif /* __AVX2__ */
+
+static int parser_string(sfparse_parser *sfp, sfparse_value *dest) {
const uint8_t *base;
- uint32_t flags = SF_VALUE_FLAG_NONE;
+#ifdef __AVX2__
+ const uint8_t *last;
+#endif /* __AVX2__ */
+ uint32_t flags = SFPARSE_VALUE_FLAG_NONE;
/* The first byte has already been validated by the caller. */
assert('"' == *sfp->pos);
base = ++sfp->pos;
+#ifdef __AVX2__
+ for (; sfp->end - sfp->pos >= 32; ++sfp->pos) {
+ last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu);
+
+ sfp->pos = find_char_string(sfp->pos, last);
+ if (sfp->pos == last) {
+ break;
+ }
+
+ switch (*sfp->pos) {
+ case '\\':
+ ++sfp->pos;
+ if (parser_eof(sfp)) {
+ return SFPARSE_ERR_PARSE;
+ }
+
+ switch (*sfp->pos) {
+ case '"':
+ case '\\':
+ flags = SFPARSE_VALUE_FLAG_ESCAPED_STRING;
+
+ break;
+ default:
+ return SFPARSE_ERR_PARSE;
+ }
+
+ break;
+ case '"':
+ goto fin;
+ default:
+ return SFPARSE_ERR_PARSE;
+ }
+ }
+#endif /* __AVX2__ */
+
for (; !parser_eof(sfp); ++sfp->pos) {
switch (*sfp->pos) {
X20_21_CASES:
@@ -585,45 +730,116 @@ static int parser_string(sf_parser *sfp, sf_value *dest) {
case '\\':
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
switch (*sfp->pos) {
case '"':
case '\\':
- flags = SF_VALUE_FLAG_ESCAPED_STRING;
+ flags = SFPARSE_VALUE_FLAG_ESCAPED_STRING;
break;
default:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
break;
case '"':
- if (dest) {
- dest->type = SF_TYPE_STRING;
- dest->flags = flags;
- dest->vec.len = (size_t)(sfp->pos - base);
- dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base;
- }
+ goto fin;
+ default:
+ return SFPARSE_ERR_PARSE;
+ }
+ }
- ++sfp->pos;
+ return SFPARSE_ERR_PARSE;
- return 0;
- default:
- return SF_ERR_PARSE_ERROR;
+fin:
+ if (dest) {
+ dest->type = SFPARSE_TYPE_STRING;
+ dest->flags = flags;
+ dest->vec.len = (size_t)(sfp->pos - base);
+ dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base;
+ }
+
+ ++sfp->pos;
+
+ return 0;
+}
+
+#ifdef __AVX2__
+static const uint8_t *find_char_token(const uint8_t *first,
+ const uint8_t *last) {
+ /* r0: !..:, excluding "(),
+ r1: A..Z
+ r2: ^..~, excluding {} */
+ const __m256i r0l = _mm256_set1_epi8('!' - 1);
+ const __m256i r0r = _mm256_set1_epi8(':' + 1);
+ const __m256i dq = _mm256_set1_epi8('"');
+ const __m256i prl = _mm256_set1_epi8('(');
+ const __m256i prr = _mm256_set1_epi8(')');
+ const __m256i comma = _mm256_set1_epi8(',');
+ const __m256i r1l = _mm256_set1_epi8('A' - 1);
+ const __m256i r1r = _mm256_set1_epi8('Z' + 1);
+ const __m256i r2l = _mm256_set1_epi8('^' - 1);
+ const __m256i r2r = _mm256_set1_epi8('~' + 1);
+ const __m256i cbl = _mm256_set1_epi8('{');
+ const __m256i cbr = _mm256_set1_epi8('}');
+ __m256i s, x;
+ uint32_t m;
+
+ for (; first != last; first += 32) {
+ s = _mm256_loadu_si256((void *)first);
+
+ x = _mm256_andnot_si256(
+ _mm256_cmpeq_epi8(s, comma),
+ _mm256_andnot_si256(
+ _mm256_cmpeq_epi8(s, prr),
+ _mm256_andnot_si256(
+ _mm256_cmpeq_epi8(s, prl),
+ _mm256_andnot_si256(_mm256_cmpeq_epi8(s, dq),
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r0l),
+ _mm256_cmpgt_epi8(r0r, s))))));
+ x = _mm256_or_si256(
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r1l), _mm256_cmpgt_epi8(r1r, s)),
+ x);
+ x = _mm256_or_si256(
+ _mm256_andnot_si256(
+ _mm256_cmpeq_epi8(s, cbr),
+ _mm256_andnot_si256(_mm256_cmpeq_epi8(s, cbl),
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r2l),
+ _mm256_cmpgt_epi8(r2r, s)))),
+ x);
+
+ m = ~(uint32_t)_mm256_movemask_epi8(x);
+ if (m) {
+ return first + ctz(m);
}
}
- return SF_ERR_PARSE_ERROR;
+ return last;
}
+#endif /* __AVX2__ */
-static int parser_token(sf_parser *sfp, sf_value *dest) {
+static int parser_token(sfparse_parser *sfp, sfparse_value *dest) {
const uint8_t *base;
+#ifdef __AVX2__
+ const uint8_t *last;
+#endif /* __AVX2__ */
/* The first byte has already been validated by the caller. */
base = sfp->pos++;
+#ifdef __AVX2__
+ if (sfp->end - sfp->pos >= 32) {
+ last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu);
+
+ sfp->pos = find_char_token(sfp->pos, last);
+ if (sfp->pos != last) {
+ goto fin;
+ }
+ }
+#endif /* __AVX2__ */
+
for (; !parser_eof(sfp); ++sfp->pos) {
switch (*sfp->pos) {
TOKEN_CASES:
@@ -633,9 +849,12 @@ static int parser_token(sf_parser *sfp, sf_value *dest) {
break;
}
+#ifdef __AVX2__
+fin:
+#endif /* __AVX2__ */
if (dest) {
- dest->type = SF_TYPE_TOKEN;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_TOKEN;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->vec.base = (uint8_t *)base;
dest->vec.len = (size_t)(sfp->pos - base);
}
@@ -643,14 +862,63 @@ static int parser_token(sf_parser *sfp, sf_value *dest) {
return 0;
}
-static int parser_byteseq(sf_parser *sfp, sf_value *dest) {
+#ifdef __AVX2__
+static const uint8_t *find_char_byteseq(const uint8_t *first,
+ const uint8_t *last) {
+ const __m256i pls = _mm256_set1_epi8('+');
+ const __m256i fs = _mm256_set1_epi8('/');
+ const __m256i r0l = _mm256_set1_epi8('0' - 1);
+ const __m256i r0r = _mm256_set1_epi8('9' + 1);
+ const __m256i r1l = _mm256_set1_epi8('A' - 1);
+ const __m256i r1r = _mm256_set1_epi8('Z' + 1);
+ const __m256i r2l = _mm256_set1_epi8('a' - 1);
+ const __m256i r2r = _mm256_set1_epi8('z' + 1);
+ __m256i s, x;
+ uint32_t m;
+
+ for (; first != last; first += 32) {
+ s = _mm256_loadu_si256((void *)first);
+
+ x = _mm256_cmpeq_epi8(s, pls);
+ x = _mm256_or_si256(_mm256_cmpeq_epi8(s, fs), x);
+ x = _mm256_or_si256(
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r0l), _mm256_cmpgt_epi8(r0r, s)),
+ x);
+ x = _mm256_or_si256(
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r1l), _mm256_cmpgt_epi8(r1r, s)),
+ x);
+ x = _mm256_or_si256(
+ _mm256_and_si256(_mm256_cmpgt_epi8(s, r2l), _mm256_cmpgt_epi8(r2r, s)),
+ x);
+
+ m = ~(uint32_t)_mm256_movemask_epi8(x);
+ if (m) {
+ return first + ctz(m);
+ }
+ }
+
+ return last;
+}
+#endif /* __AVX2__ */
+
+static int parser_byteseq(sfparse_parser *sfp, sfparse_value *dest) {
const uint8_t *base;
+#ifdef __AVX2__
+ const uint8_t *last;
+#endif /* __AVX2__ */
/* The first byte has already been validated by the caller. */
assert(':' == *sfp->pos);
base = ++sfp->pos;
+#ifdef __AVX2__
+ if (sfp->end - sfp->pos >= 32) {
+ last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu);
+ sfp->pos = find_char_byteseq(sfp->pos, last);
+ }
+#endif /* __AVX2__ */
+
for (; !parser_eof(sfp); ++sfp->pos) {
switch (*sfp->pos) {
case '+':
@@ -662,12 +930,12 @@ static int parser_byteseq(sf_parser *sfp, sf_value *dest) {
switch ((sfp->pos - base) & 0x3) {
case 0:
case 1:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
case 2:
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
if (*sfp->pos == '=') {
@@ -682,27 +950,27 @@ static int parser_byteseq(sf_parser *sfp, sf_value *dest) {
}
if (parser_eof(sfp) || *sfp->pos != ':') {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
goto fin;
case ':':
if (((sfp->pos - base) & 0x3) == 1) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
goto fin;
default:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
}
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
fin:
if (dest) {
- dest->type = SF_TYPE_BYTESEQ;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_BYTESEQ;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->vec.len = (size_t)(sfp->pos - base);
dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base;
}
@@ -712,7 +980,7 @@ fin:
return 0;
}
-static int parser_boolean(sf_parser *sfp, sf_value *dest) {
+static int parser_boolean(sfparse_parser *sfp, sfparse_value *dest) {
int b;
/* The first byte has already been validated by the caller. */
@@ -721,7 +989,7 @@ static int parser_boolean(sf_parser *sfp, sf_value *dest) {
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
switch (*sfp->pos) {
@@ -734,14 +1002,14 @@ static int parser_boolean(sf_parser *sfp, sf_value *dest) {
break;
default:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
++sfp->pos;
if (dest) {
- dest->type = SF_TYPE_BOOLEAN;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_BOOLEAN;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->boolean = b;
}
@@ -847,7 +1115,7 @@ static void utf8_decode(uint32_t *state, uint8_t byte) {
/* End of utf8 dfa */
-static int parser_dispstring(sf_parser *sfp, sf_value *dest) {
+static int parser_dispstring(sfparse_parser *sfp, sfparse_value *dest) {
const uint8_t *base;
uint8_t c;
uint32_t utf8state = UTF8_ACCEPT;
@@ -857,7 +1125,7 @@ static int parser_dispstring(sf_parser *sfp, sf_value *dest) {
++sfp->pos;
if (parser_eof(sfp) || *sfp->pos != '"') {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
base = ++sfp->pos;
@@ -866,32 +1134,32 @@ static int parser_dispstring(sf_parser *sfp, sf_value *dest) {
switch (*sfp->pos) {
X00_1F_CASES:
X7F_FF_CASES:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
case '%':
++sfp->pos;
if (sfp->pos + 2 > sfp->end) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
if (pctdecode(&c, &sfp->pos) != 0) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
utf8_decode(&utf8state, c);
if (utf8state == UTF8_REJECT) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
break;
case '"':
if (utf8state != UTF8_ACCEPT) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
if (dest) {
- dest->type = SF_TYPE_DISPSTRING;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_DISPSTRING;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->vec.len = (size_t)(sfp->pos - base);
dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base;
}
@@ -901,17 +1169,17 @@ static int parser_dispstring(sf_parser *sfp, sf_value *dest) {
return 0;
default:
if (utf8state != UTF8_ACCEPT) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
++sfp->pos;
}
}
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
-static int parser_bare_item(sf_parser *sfp, sf_value *dest) {
+static int parser_bare_item(sfparse_parser *sfp, sfparse_value *dest) {
switch (*sfp->pos) {
case '"':
return parser_string(sfp, dest);
@@ -930,28 +1198,29 @@ static int parser_bare_item(sf_parser *sfp, sf_value *dest) {
case '%':
return parser_dispstring(sfp, dest);
default:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
}
-static int parser_skip_inner_list(sf_parser *sfp);
+static int parser_skip_inner_list(sfparse_parser *sfp);
-int sf_parser_param(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value) {
+int sfparse_parser_param(sfparse_parser *sfp, sfparse_vec *dest_key,
+ sfparse_value *dest_value) {
int rv;
- switch (sfp->state & SF_STATE_OP_MASK) {
- case SF_STATE_BEFORE:
+ switch (sfp->state & SFPARSE_STATE_OP_MASK) {
+ case SFPARSE_STATE_BEFORE:
rv = parser_skip_inner_list(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_BEFORE_PARAMS:
- parser_set_op_state(sfp, SF_STATE_PARAMS);
+ case SFPARSE_STATE_BEFORE_PARAMS:
+ parser_set_op_state(sfp, SFPARSE_STATE_PARAMS);
break;
- case SF_STATE_PARAMS:
+ case SFPARSE_STATE_PARAMS:
break;
default:
assert(0);
@@ -959,16 +1228,16 @@ int sf_parser_param(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value) {
}
if (parser_eof(sfp) || *sfp->pos != ';') {
- parser_set_op_state(sfp, SF_STATE_AFTER);
+ parser_set_op_state(sfp, SFPARSE_STATE_AFTER);
- return SF_ERR_EOF;
+ return SFPARSE_ERR_EOF;
}
++sfp->pos;
parser_discard_sp(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
rv = parser_key(sfp, dest_key);
@@ -978,8 +1247,8 @@ int sf_parser_param(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value) {
if (parser_eof(sfp) || *sfp->pos != '=') {
if (dest_value) {
- dest_value->type = SF_TYPE_BOOLEAN;
- dest_value->flags = SF_VALUE_FLAG_NONE;
+ dest_value->type = SFPARSE_TYPE_BOOLEAN;
+ dest_value->flags = SFPARSE_VALUE_FLAG_NONE;
dest_value->boolean = 1;
}
@@ -989,23 +1258,23 @@ int sf_parser_param(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value) {
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
return parser_bare_item(sfp, dest_value);
}
-static int parser_skip_params(sf_parser *sfp) {
+static int parser_skip_params(sfparse_parser *sfp) {
int rv;
for (;;) {
- rv = sf_parser_param(sfp, NULL, NULL);
+ rv = sfparse_parser_param(sfp, NULL, NULL);
switch (rv) {
case 0:
break;
- case SF_ERR_EOF:
+ case SFPARSE_ERR_EOF:
return 0;
- case SF_ERR_PARSE_ERROR:
+ case SFPARSE_ERR_PARSE:
return rv;
default:
assert(0);
@@ -1014,45 +1283,45 @@ static int parser_skip_params(sf_parser *sfp) {
}
}
-int sf_parser_inner_list(sf_parser *sfp, sf_value *dest) {
+int sfparse_parser_inner_list(sfparse_parser *sfp, sfparse_value *dest) {
int rv;
- switch (sfp->state & SF_STATE_OP_MASK) {
- case SF_STATE_BEFORE:
+ switch (sfp->state & SFPARSE_STATE_OP_MASK) {
+ case SFPARSE_STATE_BEFORE:
parser_discard_sp(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
break;
- case SF_STATE_BEFORE_PARAMS:
+ case SFPARSE_STATE_BEFORE_PARAMS:
rv = parser_skip_params(sfp);
if (rv != 0) {
return rv;
}
- /* Technically, we are entering SF_STATE_AFTER, but we will set
+ /* Technically, we are entering SFPARSE_STATE_AFTER, but we will set
another state without reading the state. */
- /* parser_set_op_state(sfp, SF_STATE_AFTER); */
+ /* parser_set_op_state(sfp, SFPARSE_STATE_AFTER); */
/* fall through */
- case SF_STATE_AFTER:
+ case SFPARSE_STATE_AFTER:
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
switch (*sfp->pos) {
case ' ':
parser_discard_sp(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
break;
case ')':
break;
default:
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
break;
@@ -1065,9 +1334,9 @@ int sf_parser_inner_list(sf_parser *sfp, sf_value *dest) {
++sfp->pos;
parser_unset_inner_list_state(sfp);
- parser_set_op_state(sfp, SF_STATE_BEFORE_PARAMS);
+ parser_set_op_state(sfp, SFPARSE_STATE_BEFORE_PARAMS);
- return SF_ERR_EOF;
+ return SFPARSE_ERR_EOF;
}
rv = parser_bare_item(sfp, dest);
@@ -1075,22 +1344,22 @@ int sf_parser_inner_list(sf_parser *sfp, sf_value *dest) {
return rv;
}
- parser_set_op_state(sfp, SF_STATE_BEFORE_PARAMS);
+ parser_set_op_state(sfp, SFPARSE_STATE_BEFORE_PARAMS);
return 0;
}
-static int parser_skip_inner_list(sf_parser *sfp) {
+static int parser_skip_inner_list(sfparse_parser *sfp) {
int rv;
for (;;) {
- rv = sf_parser_inner_list(sfp, NULL);
+ rv = sfparse_parser_inner_list(sfp, NULL);
switch (rv) {
case 0:
break;
- case SF_ERR_EOF:
+ case SFPARSE_ERR_EOF:
return 0;
- case SF_ERR_PARSE_ERROR:
+ case SFPARSE_ERR_PARSE:
return rv;
default:
assert(0);
@@ -1099,39 +1368,39 @@ static int parser_skip_inner_list(sf_parser *sfp) {
}
}
-static int parser_next_key_or_item(sf_parser *sfp) {
+static int parser_next_key_or_item(sfparse_parser *sfp) {
parser_discard_ows(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_EOF;
+ return SFPARSE_ERR_EOF;
}
if (*sfp->pos != ',') {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
++sfp->pos;
parser_discard_ows(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
return 0;
}
-static int parser_dict_value(sf_parser *sfp, sf_value *dest) {
+static int parser_dict_value(sfparse_parser *sfp, sfparse_value *dest) {
int rv;
if (parser_eof(sfp) || *(sfp->pos) != '=') {
/* Boolean true */
if (dest) {
- dest->type = SF_TYPE_BOOLEAN;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_BOOLEAN;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->boolean = 1;
}
- sfp->state = SF_STATE_DICT_BEFORE_PARAMS;
+ sfp->state = SFPARSE_STATE_DICT_BEFORE_PARAMS;
return 0;
}
@@ -1139,18 +1408,18 @@ static int parser_dict_value(sf_parser *sfp, sf_value *dest) {
++sfp->pos;
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
if (*sfp->pos == '(') {
if (dest) {
- dest->type = SF_TYPE_INNER_LIST;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_INNER_LIST;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
}
++sfp->pos;
- sfp->state = SF_STATE_DICT_INNER_LIST_BEFORE;
+ sfp->state = SFPARSE_STATE_DICT_INNER_LIST_BEFORE;
return 0;
}
@@ -1160,41 +1429,42 @@ static int parser_dict_value(sf_parser *sfp, sf_value *dest) {
return rv;
}
- sfp->state = SF_STATE_DICT_BEFORE_PARAMS;
+ sfp->state = SFPARSE_STATE_DICT_BEFORE_PARAMS;
return 0;
}
-int sf_parser_dict(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value) {
+int sfparse_parser_dict(sfparse_parser *sfp, sfparse_vec *dest_key,
+ sfparse_value *dest_value) {
int rv;
switch (sfp->state) {
- case SF_STATE_DICT_INNER_LIST_BEFORE:
+ case SFPARSE_STATE_DICT_INNER_LIST_BEFORE:
rv = parser_skip_inner_list(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_DICT_BEFORE_PARAMS:
+ case SFPARSE_STATE_DICT_BEFORE_PARAMS:
rv = parser_skip_params(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_DICT_AFTER:
+ case SFPARSE_STATE_DICT_AFTER:
rv = parser_next_key_or_item(sfp);
if (rv != 0) {
return rv;
}
break;
- case SF_STATE_INITIAL:
+ case SFPARSE_STATE_INITIAL:
parser_discard_sp(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_EOF;
+ return SFPARSE_ERR_EOF;
}
break;
@@ -1211,36 +1481,36 @@ int sf_parser_dict(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value) {
return parser_dict_value(sfp, dest_value);
}
-int sf_parser_list(sf_parser *sfp, sf_value *dest) {
+int sfparse_parser_list(sfparse_parser *sfp, sfparse_value *dest) {
int rv;
switch (sfp->state) {
- case SF_STATE_LIST_INNER_LIST_BEFORE:
+ case SFPARSE_STATE_LIST_INNER_LIST_BEFORE:
rv = parser_skip_inner_list(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_LIST_BEFORE_PARAMS:
+ case SFPARSE_STATE_LIST_BEFORE_PARAMS:
rv = parser_skip_params(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_LIST_AFTER:
+ case SFPARSE_STATE_LIST_AFTER:
rv = parser_next_key_or_item(sfp);
if (rv != 0) {
return rv;
}
break;
- case SF_STATE_INITIAL:
+ case SFPARSE_STATE_INITIAL:
parser_discard_sp(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_EOF;
+ return SFPARSE_ERR_EOF;
}
break;
@@ -1251,13 +1521,13 @@ int sf_parser_list(sf_parser *sfp, sf_value *dest) {
if (*sfp->pos == '(') {
if (dest) {
- dest->type = SF_TYPE_INNER_LIST;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_INNER_LIST;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
}
++sfp->pos;
- sfp->state = SF_STATE_LIST_INNER_LIST_BEFORE;
+ sfp->state = SFPARSE_STATE_LIST_INNER_LIST_BEFORE;
return 0;
}
@@ -1267,45 +1537,45 @@ int sf_parser_list(sf_parser *sfp, sf_value *dest) {
return rv;
}
- sfp->state = SF_STATE_LIST_BEFORE_PARAMS;
+ sfp->state = SFPARSE_STATE_LIST_BEFORE_PARAMS;
return 0;
}
-int sf_parser_item(sf_parser *sfp, sf_value *dest) {
+int sfparse_parser_item(sfparse_parser *sfp, sfparse_value *dest) {
int rv;
switch (sfp->state) {
- case SF_STATE_INITIAL:
+ case SFPARSE_STATE_INITIAL:
parser_discard_sp(sfp);
if (parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
break;
- case SF_STATE_ITEM_INNER_LIST_BEFORE:
+ case SFPARSE_STATE_ITEM_INNER_LIST_BEFORE:
rv = parser_skip_inner_list(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_ITEM_BEFORE_PARAMS:
+ case SFPARSE_STATE_ITEM_BEFORE_PARAMS:
rv = parser_skip_params(sfp);
if (rv != 0) {
return rv;
}
/* fall through */
- case SF_STATE_ITEM_AFTER:
+ case SFPARSE_STATE_ITEM_AFTER:
parser_discard_sp(sfp);
if (!parser_eof(sfp)) {
- return SF_ERR_PARSE_ERROR;
+ return SFPARSE_ERR_PARSE;
}
- return SF_ERR_EOF;
+ return SFPARSE_ERR_EOF;
default:
assert(0);
abort();
@@ -1313,13 +1583,13 @@ int sf_parser_item(sf_parser *sfp, sf_value *dest) {
if (*sfp->pos == '(') {
if (dest) {
- dest->type = SF_TYPE_INNER_LIST;
- dest->flags = SF_VALUE_FLAG_NONE;
+ dest->type = SFPARSE_TYPE_INNER_LIST;
+ dest->flags = SFPARSE_VALUE_FLAG_NONE;
}
++sfp->pos;
- sfp->state = SF_STATE_ITEM_INNER_LIST_BEFORE;
+ sfp->state = SFPARSE_STATE_ITEM_INNER_LIST_BEFORE;
return 0;
}
@@ -1329,12 +1599,13 @@ int sf_parser_item(sf_parser *sfp, sf_value *dest) {
return rv;
}
- sfp->state = SF_STATE_ITEM_BEFORE_PARAMS;
+ sfp->state = SFPARSE_STATE_ITEM_BEFORE_PARAMS;
return 0;
}
-void sf_parser_init(sf_parser *sfp, const uint8_t *data, size_t datalen) {
+void sfparse_parser_init(sfparse_parser *sfp, const uint8_t *data,
+ size_t datalen) {
if (datalen == 0) {
sfp->pos = sfp->end = NULL;
} else {
@@ -1342,10 +1613,10 @@ void sf_parser_init(sf_parser *sfp, const uint8_t *data, size_t datalen) {
sfp->end = data + datalen;
}
- sfp->state = SF_STATE_INITIAL;
+ sfp->state = SFPARSE_STATE_INITIAL;
}
-void sf_unescape(sf_vec *dest, const sf_vec *src) {
+void sfparse_unescape(sfparse_vec *dest, const sfparse_vec *src) {
const uint8_t *p, *q;
uint8_t *o;
size_t len, slen;
@@ -1381,23 +1652,22 @@ void sf_unescape(sf_vec *dest, const sf_vec *src) {
}
}
-void sf_base64decode(sf_vec *dest, const sf_vec *src) {
+void sfparse_base64decode(sfparse_vec *dest, const sfparse_vec *src) {
static const int index_tbl[] = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1};
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1,
+ -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1};
uint8_t *o;
const uint8_t *p, *end;
uint32_t n;
@@ -1478,7 +1748,7 @@ fin:
dest->len = (size_t)(o - dest->base);
}
-void sf_pctdecode(sf_vec *dest, const sf_vec *src) {
+void sfparse_pctdecode(sfparse_vec *dest, const sfparse_vec *src) {
const uint8_t *p, *q;
uint8_t *o;
size_t len, slen;
diff --git a/contrib/libs/nghttp3/lib/sfparse/sfparse.h b/contrib/libs/nghttp3/lib/sfparse/sfparse.h
index 01cc947d4d..9341221a09 100644
--- a/contrib/libs/nghttp3/lib/sfparse/sfparse.h
+++ b/contrib/libs/nghttp3/lib/sfparse/sfparse.h
@@ -31,90 +31,90 @@
libcurl) */
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
-#endif
+#endif /* (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) */
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* defined(__cplusplus) */
#if defined(_MSC_VER) && (_MSC_VER < 1800)
/* MSVC < 2013 does not have inttypes.h because it is not C99
compliant. See compiler macros and version number in
https://sourceforge.net/p/predef/wiki/Compilers/ */
# include <stdint.h>
-#else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
+#else /* !(defined(_MSC_VER) && (_MSC_VER < 1800)) */
# include <inttypes.h>
-#endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
+#endif /* !(defined(_MSC_VER) && (_MSC_VER < 1800)) */
#include <sys/types.h>
#include <stddef.h>
/**
* @enum
*
- * :type:`sf_type` defines value type.
+ * :type:`sfparse_type` defines value type.
*/
-typedef enum sf_type {
+typedef enum sfparse_type {
/**
- * :enum:`SF_TYPE_BOOLEAN` indicates boolean type.
+ * :enum:`SFPARSE_TYPE_BOOLEAN` indicates boolean type.
*/
- SF_TYPE_BOOLEAN,
+ SFPARSE_TYPE_BOOLEAN,
/**
- * :enum:`SF_TYPE_INTEGER` indicates integer type.
+ * :enum:`SFPARSE_TYPE_INTEGER` indicates integer type.
*/
- SF_TYPE_INTEGER,
+ SFPARSE_TYPE_INTEGER,
/**
- * :enum:`SF_TYPE_DECIMAL` indicates decimal type.
+ * :enum:`SFPARSE_TYPE_DECIMAL` indicates decimal type.
*/
- SF_TYPE_DECIMAL,
+ SFPARSE_TYPE_DECIMAL,
/**
- * :enum:`SF_TYPE_STRING` indicates string type.
+ * :enum:`SFPARSE_TYPE_STRING` indicates string type.
*/
- SF_TYPE_STRING,
+ SFPARSE_TYPE_STRING,
/**
- * :enum:`SF_TYPE_TOKEN` indicates token type.
+ * :enum:`SFPARSE_TYPE_TOKEN` indicates token type.
*/
- SF_TYPE_TOKEN,
+ SFPARSE_TYPE_TOKEN,
/**
- * :enum:`SF_TYPE_BYTESEQ` indicates byte sequence type.
+ * :enum:`SFPARSE_TYPE_BYTESEQ` indicates byte sequence type.
*/
- SF_TYPE_BYTESEQ,
+ SFPARSE_TYPE_BYTESEQ,
/**
- * :enum:`SF_TYPE_INNER_LIST` indicates inner list type.
+ * :enum:`SFPARSE_TYPE_INNER_LIST` indicates inner list type.
*/
- SF_TYPE_INNER_LIST,
+ SFPARSE_TYPE_INNER_LIST,
/**
- * :enum:`SF_TYPE_DATE` indicates date type.
+ * :enum:`SFPARSE_TYPE_DATE` indicates date type.
*/
- SF_TYPE_DATE,
+ SFPARSE_TYPE_DATE,
/**
- * :enum:`SF_TYPE_DISPSTRING` indicates display string type.
+ * :enum:`SFPARSE_TYPE_DISPSTRING` indicates display string type.
*/
- SF_TYPE_DISPSTRING
-} sf_type;
+ SFPARSE_TYPE_DISPSTRING
+} sfparse_type;
/**
* @macro
*
- * :macro:`SF_ERR_PARSE_ERROR` indicates fatal parse error has
+ * :macro:`SFPARSE_ERR_PARSE` indicates fatal parse error has
* occurred, and it is not possible to continue the processing.
*/
-#define SF_ERR_PARSE_ERROR -1
+#define SFPARSE_ERR_PARSE -1
/**
* @macro
*
- * :macro:`SF_ERR_EOF` indicates that there is nothing left to read.
- * The context of this error varies depending on the function that
- * returns this error code.
+ * :macro:`SFPARSE_ERR_EOF` indicates that there is nothing left to
+ * read. The context of this error varies depending on the function
+ * that returns this error code.
*/
-#define SF_ERR_EOF -2
+#define SFPARSE_ERR_EOF -2
/**
* @struct
*
- * :type:`sf_vec` stores sequence of bytes.
+ * :type:`sfparse_vec` stores sequence of bytes.
*/
-typedef struct sf_vec {
+typedef struct sfparse_vec {
/**
* :member:`base` points to the beginning of the sequence of bytes.
*/
@@ -123,29 +123,29 @@ typedef struct sf_vec {
* :member:`len` is the number of bytes contained in this sequence.
*/
size_t len;
-} sf_vec;
+} sfparse_vec;
/**
* @macro
*
- * :macro:`SF_VALUE_FLAG_NONE` indicates no flag set.
+ * :macro:`SFPARSE_VALUE_FLAG_NONE` indicates no flag set.
*/
-#define SF_VALUE_FLAG_NONE 0x0u
+#define SFPARSE_VALUE_FLAG_NONE 0x0u
/**
* @macro
*
- * :macro:`SF_VALUE_FLAG_ESCAPED_STRING` indicates that a string
+ * :macro:`SFPARSE_VALUE_FLAG_ESCAPED_STRING` indicates that a string
* contains escaped character(s).
*/
-#define SF_VALUE_FLAG_ESCAPED_STRING 0x1u
+#define SFPARSE_VALUE_FLAG_ESCAPED_STRING 0x1u
/**
* @struct
*
- * :type:`sf_decimal` contains decimal value.
+ * :type:`sfparse_decimal` contains decimal value.
*/
-typedef struct sf_decimal {
+typedef struct sfparse_decimal {
/**
* :member:`numer` contains numerator of the decimal value.
*/
@@ -154,275 +154,289 @@ typedef struct sf_decimal {
* :member:`denom` contains denominator of the decimal value.
*/
int64_t denom;
-} sf_decimal;
+} sfparse_decimal;
/**
* @struct
*
- * :type:`sf_value` stores a Structured Field item. For Inner List,
- * only type is set to :enum:`sf_type.SF_TYPE_INNER_LIST`. In order
- * to read the items contained in an inner list, call
- * `sf_parser_inner_list`.
+ * :type:`sfparse_value` stores a Structured Field item. For Inner
+ * List, only type is set to
+ * :enum:`sfparse_type.SFPARSE_TYPE_INNER_LIST`. In order to read the
+ * items contained in an inner list, call `sfparse_parser_inner_list`.
*/
-typedef struct sf_value {
+typedef struct sfparse_value {
/**
* :member:`type` is the type of the value contained in this
* particular object.
*/
- sf_type type;
+ sfparse_type type;
/**
* :member:`flags` is bitwise OR of one or more of
- * :macro:`SF_VALUE_FLAG_* <SF_VALUE_FLAG_NONE>`.
+ * :macro:`SFPARSE_VALUE_FLAG_* <SFPARSE_VALUE_FLAG_NONE>`.
*/
uint32_t flags;
/**
* @anonunion_start
*
- * @sf_value_value
+ * @sfparse_value_value
*/
union {
/**
* :member:`boolean` contains boolean value if :member:`type` ==
- * :enum:`sf_type.SF_TYPE_BOOLEAN`. 1 indicates true, and 0
- * indicates false.
+ * :enum:`sfparse_type.SFPARSE_TYPE_BOOLEAN`. 1 indicates true,
+ * and 0 indicates false.
*/
int boolean;
/**
* :member:`integer` contains integer value if :member:`type` is
- * either :enum:`sf_type.SF_TYPE_INTEGER` or
- * :enum:`sf_type.SF_TYPE_DATE`.
+ * either :enum:`sfparse_type.SFPARSE_TYPE_INTEGER` or
+ * :enum:`sfparse_type.SFPARSE_TYPE_DATE`.
*/
int64_t integer;
/**
* :member:`decimal` contains decimal value if :member:`type` ==
- * :enum:`sf_type.SF_TYPE_DECIMAL`.
+ * :enum:`sfparse_type.SFPARSE_TYPE_DECIMAL`.
*/
- sf_decimal decimal;
+ sfparse_decimal decimal;
/**
* :member:`vec` contains sequence of bytes if :member:`type` is
- * either :enum:`sf_type.SF_TYPE_STRING`,
- * :enum:`sf_type.SF_TYPE_TOKEN`, :enum:`sf_type.SF_TYPE_BYTESEQ`,
- * or :enum:`sf_type.SF_TYPE_DISPSTRING`.
+ * either :enum:`sfparse_type.SFPARSE_TYPE_STRING`,
+ * :enum:`sfparse_type.SFPARSE_TYPE_TOKEN`,
+ * :enum:`sfparse_type.SFPARSE_TYPE_BYTESEQ`, or
+ * :enum:`sfparse_type.SFPARSE_TYPE_DISPSTRING`.
*
- * For :enum:`sf_type.SF_TYPE_STRING`, this field contains one or
- * more escaped characters if :member:`flags` has
- * :macro:`SF_VALUE_FLAG_ESCAPED_STRING` set. To unescape the
- * string, use `sf_unescape`.
+ * For :enum:`sfparse_type.SFPARSE_TYPE_STRING`, this field
+ * contains one or more escaped characters if :member:`flags` has
+ * :macro:`SFPARSE_VALUE_FLAG_ESCAPED_STRING` set. To unescape
+ * the string, use `sfparse_unescape`.
*
- * For :enum:`sf_type.SF_TYPE_BYTESEQ`, this field contains base64
- * encoded string. To decode this byte string, use
- * `sf_base64decode`.
+ * For :enum:`sfparse_type.SFPARSE_TYPE_BYTESEQ`, this field
+ * contains base64 encoded string. To decode this byte string,
+ * use `sfparse_base64decode`.
*
- * For :enum:`sf_type.SF_TYPE_DISPSTRING`, this field may contain
- * percent-encoded UTF-8 byte sequences. To decode it, use
- * `sf_pctdecode`.
+ * For :enum:`sfparse_type.SFPARSE_TYPE_DISPSTRING`, this field
+ * may contain percent-encoded UTF-8 byte sequences. To decode
+ * it, use `sfparse_pctdecode`.
*
- * If :member:`vec.len <sf_vec.len>` == 0, :member:`vec.base
- * <sf_vec.base>` is guaranteed to be NULL.
+ * If :member:`vec.len <sfparse_vec.len>` == 0, :member:`vec.base
+ * <sfparse_vec.base>` is guaranteed to be NULL.
*/
- sf_vec vec;
+ sfparse_vec vec;
/**
* @anonunion_end
*/
};
-} sf_value;
+} sfparse_value;
/**
* @struct
*
- * :type:`sf_parser` is the Structured Field Values parser. Use
- * `sf_parser_init` to initialize it.
+ * :type:`sfparse_parser` is the Structured Field Values parser. Use
+ * `sfparse_parser_init` to initialize it.
*/
-typedef struct sf_parser {
+typedef struct sfparse_parser {
/* all fields are private */
const uint8_t *pos;
const uint8_t *end;
uint32_t state;
-} sf_parser;
+} sfparse_parser;
/**
* @function
*
- * `sf_parser_init` initializes |sfp| with the given buffer pointed by
- * |data| of length |datalen|.
+ * `sfparse_parser_init` initializes |sfp| with the given data encoded
+ * in Structured Field Values pointed by |data| of length |datalen|.
*/
-void sf_parser_init(sf_parser *sfp, const uint8_t *data, size_t datalen);
+void sfparse_parser_init(sfparse_parser *sfp, const uint8_t *data,
+ size_t datalen);
/**
* @function
*
- * `sf_parser_param` reads a parameter. If this function returns 0,
- * it stores parameter key and value in |dest_key| and |dest_value|
+ * `sfparse_parser_param` reads a parameter. If this function returns
+ * 0, it stores parameter key and value in |dest_key| and |dest_value|
* respectively, if they are not NULL.
*
* This function does no effort to find duplicated keys. Same key may
* be reported more than once.
*
* Caller should keep calling this function until it returns negative
- * error code. If it returns :macro:`SF_ERR_EOF`, all parameters have
- * read, and caller can continue to read rest of the values. If it
- * returns :macro:`SF_ERR_PARSE_ERROR`, it encountered fatal error
+ * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all parameters
+ * have read, and caller can continue to read rest of the values. If
+ * it returns :macro:`SFPARSE_ERR_PARSE`, it encountered fatal error
* while parsing field value.
*/
-int sf_parser_param(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value);
+int sfparse_parser_param(sfparse_parser *sfp, sfparse_vec *dest_key,
+ sfparse_value *dest_value);
/**
* @function
*
- * `sf_parser_dict` reads the next dictionary key and value pair. If
- * this function returns 0, it stores the key and value in |dest_key|
- * and |dest_value| respectively, if they are not NULL.
+ * `sfparse_parser_dict` reads the next dictionary key and value pair.
+ * If this function returns 0, it stores the key and value in
+ * |dest_key| and |dest_value| respectively, if they are not NULL.
*
* Caller can optionally read parameters attached to the pair by
- * calling `sf_parser_param`.
+ * calling `sfparse_parser_param`.
*
* This function does no effort to find duplicated keys. Same key may
* be reported more than once.
*
* Caller should keep calling this function until it returns negative
- * error code. If it returns :macro:`SF_ERR_EOF`, all key and value
- * pairs have been read, and there is nothing left to read.
+ * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all key and
+ * value pairs have been read, and there is nothing left to read.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
- * :macro:`SF_ERR_EOF`
+ * :macro:`SFPARSE_ERR_EOF`
* All values in the dictionary have read.
- * :macro:`SF_ERR_PARSE_ERROR`
+ * :macro:`SFPARSE_ERR_PARSE`
* It encountered fatal error while parsing field value.
*/
-int sf_parser_dict(sf_parser *sfp, sf_vec *dest_key, sf_value *dest_value);
+int sfparse_parser_dict(sfparse_parser *sfp, sfparse_vec *dest_key,
+ sfparse_value *dest_value);
/**
* @function
*
- * `sf_parser_list` reads the next list item. If this function
+ * `sfparse_parser_list` reads the next list item. If this function
* returns 0, it stores the item in |dest| if it is not NULL.
*
* Caller can optionally read parameters attached to the item by
- * calling `sf_parser_param`.
+ * calling `sfparse_parser_param`.
*
* Caller should keep calling this function until it returns negative
- * error code. If it returns :macro:`SF_ERR_EOF`, all values in the
- * list have been read, and there is nothing left to read.
+ * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all values in
+ * the list have been read, and there is nothing left to read.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
- * :macro:`SF_ERR_EOF`
+ * :macro:`SFPARSE_ERR_EOF`
* All values in the list have read.
- * :macro:`SF_ERR_PARSE_ERROR`
+ * :macro:`SFPARSE_ERR_PARSE`
* It encountered fatal error while parsing field value.
*/
-int sf_parser_list(sf_parser *sfp, sf_value *dest);
+int sfparse_parser_list(sfparse_parser *sfp, sfparse_value *dest);
/**
* @function
*
- * `sf_parser_item` reads a single item. If this function returns 0,
- * it stores the item in |dest| if it is not NULL.
+ * `sfparse_parser_item` reads a single item. If this function
+ * returns 0, it stores the item in |dest| if it is not NULL.
*
* This function is only used for the field value that consists of a
* single item.
*
* Caller can optionally read parameters attached to the item by
- * calling `sf_parser_param`.
+ * calling `sfparse_parser_param`.
*
* Caller should call this function again to make sure that there is
* nothing left to read. If this 2nd function call returns
- * :macro:`SF_ERR_EOF`, all data have been processed successfully.
+ * :macro:`SFPARSE_ERR_EOF`, all data have been processed
+ * successfully.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
- * :macro:`SF_ERR_EOF`
+ * :macro:`SFPARSE_ERR_EOF`
* There is nothing left to read.
- * :macro:`SF_ERR_PARSE_ERROR`
+ * :macro:`SFPARSE_ERR_PARSE`
* It encountered fatal error while parsing field value.
*/
-int sf_parser_item(sf_parser *sfp, sf_value *dest);
+int sfparse_parser_item(sfparse_parser *sfp, sfparse_value *dest);
/**
* @function
*
- * `sf_parser_inner_list` reads the next inner list item. If this
- * function returns 0, it stores the item in |dest| if it is not NULL.
+ * `sfparse_parser_inner_list` reads the next inner list item. If
+ * this function returns 0, it stores the item in |dest| if it is not
+ * NULL.
*
* Caller can optionally read parameters attached to the item by
- * calling `sf_parser_param`.
+ * calling `sfparse_parser_param`.
*
* Caller should keep calling this function until it returns negative
- * error code. If it returns :macro:`SF_ERR_EOF`, all values in this
- * inner list have been read, and caller can optionally read
+ * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all values in
+ * this inner list have been read, and caller can optionally read
* parameters attached to this inner list by calling
- * `sf_parser_param`. Then caller can continue to read rest of the
- * values.
+ * `sfparse_parser_param`. Then caller can continue to read rest of
+ * the values.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
- * :macro:`SF_ERR_EOF`
+ * :macro:`SFPARSE_ERR_EOF`
* All values in the inner list have read.
- * :macro:`SF_ERR_PARSE_ERROR`
+ * :macro:`SFPARSE_ERR_PARSE`
* It encountered fatal error while parsing field value.
*/
-int sf_parser_inner_list(sf_parser *sfp, sf_value *dest);
+int sfparse_parser_inner_list(sfparse_parser *sfp, sfparse_value *dest);
/**
* @function
*
- * `sf_unescape` copies |src| to |dest| by removing escapes (``\``).
- * |src| should be the pointer to :member:`sf_value.vec` of type
- * :enum:`sf_type.SF_TYPE_STRING` produced by either `sf_parser_dict`,
- * `sf_parser_list`, `sf_parser_inner_list`, `sf_parser_item`, or
- * `sf_parser_param`, otherwise the behavior is undefined.
+ * `sfparse_unescape` copies |src| to |dest| by removing escapes
+ * (``\``). |src| should be the pointer to
+ * :member:`sfparse_value.vec` of type
+ * :enum:`sfparse_type.SFPARSE_TYPE_STRING` produced by either
+ * `sfparse_parser_dict`, `sfparse_parser_list`,
+ * `sfparse_parser_inner_list`, `sfparse_parser_item`, or
+ * `sfparse_parser_param`, otherwise the behavior is undefined.
*
- * :member:`dest->base <sf_vec.base>` must point to the buffer that
- * has sufficient space to store the unescaped string.
+ * :member:`dest->base <sfparse_vec.base>` must point to the buffer
+ * that has sufficient space to store the unescaped string. The
+ * memory areas pointed by :member:`dest->base <sfparse_vec.base>` and
+ * :member:`src->base <sfparse_vec.base>` must not overlap.
*
* This function sets the length of unescaped string to
- * :member:`dest->len <sf_vec.len>`.
+ * :member:`dest->len <sfparse_vec.len>`.
*/
-void sf_unescape(sf_vec *dest, const sf_vec *src);
+void sfparse_unescape(sfparse_vec *dest, const sfparse_vec *src);
/**
* @function
*
- * `sf_base64decode` decodes Base64 encoded string |src| and writes
- * the result into |dest|. |src| should be the pointer to
- * :member:`sf_value.vec` of type :enum:`sf_type.SF_TYPE_BYTESEQ`
- * produced by either `sf_parser_dict`, `sf_parser_list`,
- * `sf_parser_inner_list`, `sf_parser_item`, or `sf_parser_param`,
- * otherwise the behavior is undefined.
+ * `sfparse_base64decode` decodes Base64 encoded string |src| and
+ * writes the result into |dest|. |src| should be the pointer to
+ * :member:`sfparse_value.vec` of type
+ * :enum:`sfparse_type.SFPARSE_TYPE_BYTESEQ` produced by either
+ * `sfparse_parser_dict`, `sfparse_parser_list`,
+ * `sfparse_parser_inner_list`, `sfparse_parser_item`, or
+ * `sfparse_parser_param`, otherwise the behavior is undefined.
*
- * :member:`dest->base <sf_vec.base>` must point to the buffer that
- * has sufficient space to store the decoded byte string.
+ * :member:`dest->base <sfparse_vec.base>` must point to the buffer
+ * that has sufficient space to store the decoded byte string.
*
* This function sets the length of decoded byte string to
- * :member:`dest->len <sf_vec.len>`.
+ * :member:`dest->len <sfparse_vec.len>`.
*/
-void sf_base64decode(sf_vec *dest, const sf_vec *src);
+void sfparse_base64decode(sfparse_vec *dest, const sfparse_vec *src);
/**
* @function
*
- * `sf_pctdecode` decodes percent-encoded string |src| and writes the
- * result into |dest|. |src| should be the pointer to
- * :member:`sf_value.vec` of type :enum:`sf_type.SF_TYPE_DISPSTRING`
- * produced by either `sf_parser_dict`, `sf_parser_list`,
- * `sf_parser_inner_list`, `sf_parser_item`, or `sf_parser_param`,
- * otherwise the behavior is undefined.
+ * `sfparse_pctdecode` decodes percent-encoded string |src| and writes
+ * the result into |dest|. |src| should be the pointer to
+ * :member:`sfparse_value.vec` of type
+ * :enum:`sfparse_type.SFPARSE_TYPE_DISPSTRING` produced by either
+ * `sfparse_parser_dict`, `sfparse_parser_list`,
+ * `sfparse_parser_inner_list`, `sfparse_parser_item`, or
+ * `sfparse_parser_param`, otherwise the behavior is undefined.
*
- * :member:`dest->base <sf_vec.base>` must point to the buffer that
- * has sufficient space to store the decoded byte string.
+ * :member:`dest->base <sfparse_vec.base>` must point to the buffer
+ * that has sufficient space to store the decoded byte string. The
+ * memory areas pointed by :member:`dest->base <sfparse_vec.base>` and
+ * :member:`src->base <sfparse_vec.base>` must not overlap.
*
* This function sets the length of decoded byte string to
- * :member:`dest->len <sf_vec.len>`.
+ * :member:`dest->len <sfparse_vec.len>`.
*/
-void sf_pctdecode(sf_vec *dest, const sf_vec *src);
+void sfparse_pctdecode(sfparse_vec *dest, const sfparse_vec *src);
#ifdef __cplusplus
}
-#endif
+#endif /* defined(__cplusplus) */
-#endif /* SFPARSE_H */
+#endif /* !defined(SFPARSE_H) */
diff --git a/contrib/libs/nghttp3/patches/include.patch b/contrib/libs/nghttp3/patches/include.patch
new file mode 100644
index 0000000000..b7b1105ad5
--- /dev/null
+++ b/contrib/libs/nghttp3/patches/include.patch
@@ -0,0 +1,5 @@
+--- contrib/libs/nghttp3/lib/includes/nghttp3/nghttp3.h (index)
++++ contrib/libs/nghttp3/lib/includes/nghttp3/nghttp3.h (working tree)
+@@ -50,1 +50,1 @@ extern "C" {
+-#include <nghttp3/version.h>
++#include "version.h"
diff --git a/contrib/libs/nghttp3/patches/staticlib.patch b/contrib/libs/nghttp3/patches/staticlib.patch
index aa0e6d5625..5ab47adfdd 100644
--- a/contrib/libs/nghttp3/patches/staticlib.patch
+++ b/contrib/libs/nghttp3/patches/staticlib.patch
@@ -1,11 +1,5 @@
--- a/lib/includes/nghttp3/nghttp3.h
+++ b/lib/includes/nghttp3/nghttp3.h
-@@ -55,7 +55,7 @@ extern "C" {
-
- #include <nghttp3/version.h>
-
+@@ -55,1 +55,1 @@ extern "C" {
-#ifdef NGHTTP3_STATICLIB
+#if 1
- # define NGHTTP3_EXTERN
- #elif defined(WIN32)
- # ifdef BUILDING_NGHTTP3
diff --git a/contrib/libs/nghttp3/ya.make b/contrib/libs/nghttp3/ya.make
index 486e365e48..47b2d755f5 100644
--- a/contrib/libs/nghttp3/ya.make
+++ b/contrib/libs/nghttp3/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(1.6.0)
+VERSION(1.7.0)
-ORIGINAL_SOURCE(https://github.com/ngtcp2/nghttp3/releases/download/v1.6.0/nghttp3-1.6.0.tar.xz)
+ORIGINAL_SOURCE(https://github.com/ngtcp2/nghttp3/releases/download/v1.7.0/nghttp3-1.7.0.tar.xz)
LICENSE(
FSFAP AND
@@ -13,10 +13,6 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-PEERDIR(
- contrib/libs/nghttp2
-)
-
ADDINCL(
GLOBAL contrib/libs/nghttp3/lib/includes
contrib/libs/nghttp3
@@ -30,6 +26,7 @@ CFLAGS(
-DBUILDING_NGHTTP3
-DHAVE_CONFIG_H
-DNGHTTP3_STATICLIB
+ -Dsfparse_parser_dict=nghttp3_sfparse_parser_dict
)
SRCS(
@@ -61,6 +58,7 @@ SRCS(
lib/nghttp3_unreachable.c
lib/nghttp3_vec.c
lib/nghttp3_version.c
+ lib/sfparse/sfparse.c
)
END()