Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 59 additions & 7 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,63 @@ AlignConsecutiveAssignments:
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: true
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseArrows: false
AlignCaseColons: false
AlignConsecutiveTableGenBreakingDAGArgColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenCondOperatorColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenDefinitionColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Expand All @@ -45,22 +74,24 @@ AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BinPackLongBracedList: true
BinPackParameters: BinPack
BitFieldColonSpacing: Both
BracedInitializerIndentWidth: -1
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
Expand All @@ -83,15 +114,20 @@ BraceWrapping:
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: None
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTemplateCloser: false
BreakBeforeTernaryOperators: true
BreakBinaryOperations: Never
BreakConstructorInitializers: BeforeColon
BreakFunctionDefinitionParameters: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
BreakTemplateDeclarations: MultiLine
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
Expand All @@ -102,6 +138,7 @@ DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
EnumTrailingComma: Leave
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
Expand Down Expand Up @@ -129,6 +166,7 @@ IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExportBlock: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: AfterHash
Expand All @@ -147,22 +185,28 @@ IntegerLiteralSeparator:
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
KeepEmptyLinesAtEOF: false
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: true
KeepFormFeed: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MainIncludeChar: Quote
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
OneLineFormatOffRegex: ''
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakBeforeMemberAccess: 150
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
Expand All @@ -176,20 +220,24 @@ PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
ReflowComments: Always
RemoveBracesLLVM: false
RemoveEmptyLinesInUnwrappedLines: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: Never
SortIncludes:
Enabled: false
IgnoreCase: false
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterOperatorKeyword: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
Expand All @@ -205,6 +253,7 @@ SpaceBeforeParensOptions:
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterNot: false
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
Expand All @@ -221,6 +270,7 @@ SpacesInLineCommentPrefix:
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Expand All @@ -233,6 +283,7 @@ StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
- munit_void_test_decl
TableGenBreakInsideDAGArg: DontBreak
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
Expand All @@ -242,5 +293,6 @@ WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
WrapNamespaceBodyWithEmptyLines: Leave
...

10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26, macos-15]
os: [ubuntu-26.04, ubuntu-26.04-arm, macos-26, macos-15]
compiler: [gcc, clang]

runs-on: ${{ matrix.os }}
Expand All @@ -23,7 +23,7 @@ jobs:
sudo apt-get update
sudo apt-get install \
g++-14 \
clang-19 \
clang-21 \
autoconf \
automake \
autotools-dev \
Expand All @@ -42,8 +42,8 @@ jobs:
- name: Setup clang (Linux)
if: runner.os == 'Linux' && matrix.compiler == 'clang'
run: |
echo 'CC=clang-19' >> $GITHUB_ENV
echo 'CXX=clang++-19' >> $GITHUB_ENV
echo 'CC=clang-21' >> $GITHUB_ENV
echo 'CXX=clang++-21' >> $GITHUB_ENV
- name: Setup clang (MacOS)
if: runner.os == 'macOS' && matrix.compiler == 'clang'
run: |
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
matrix:
host: [x86_64-w64-mingw32, i686-w64-mingw32]

runs-on: ubuntu-24.04
runs-on: ubuntu-26.04

env:
HOST: ${{ matrix.host }}
Expand Down
60 changes: 16 additions & 44 deletions http_parser_compat_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,66 +623,38 @@ static const struct url_test url_tests[] =
},
};

static void dump_url(const char *url, const urlparse_url *u) {
size_t i;

fprintf(stderr, "\tfield_set: 0x%x, port: %u\n", u->field_set, u->port);
for (i = 0; i < URLPARSE_MAX; i++) {
if ((u->field_set & (1 << i)) == 0) {
fprintf(stderr, "\tfield_data[%zu]: unset\n", i);
continue;
}

fprintf(stderr, "\tfield_data[%zu]: off: %u len: %u part: \"%.*s\"\n", i,
u->field_data[i].off, u->field_data[i].len, u->field_data[i].len,
url + u->field_data[i].off);
}
}

void test_http_parser_compat(void) {
urlparse_url u;
const struct url_test *test;
size_t i;
size_t i, j;
int rv;

for (i = 0; i < (sizeof(url_tests) / sizeof(url_tests[0])); ++i) {
test = &url_tests[i];
memset(&u, 0, sizeof(u));

munit_log(MUNIT_LOG_INFO, test->name);

rv = urlparse_parse_url(test->url, test->url ? strlen(test->url) : 0,
test->is_connect, &u);

if (test->rv == 0) {
if (rv != 0) {
fprintf(stderr,
"\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, "
"unexpected rv %d ***\n\n",
test->url, test->name, rv);

assert_int(0, ==, rv);
}
assert_int(test->rv, ==, rv);

if (memcmp(&u, &test->u, sizeof(u)) != 0) {
fprintf(stderr,
"\n*** http_parser_parse_url(\"%s\") \"%s\" failed ***\n",
test->url, test->name);
if (test->rv != 0) {
continue;
}

fprintf(stderr, "target http_parser_url:\n");
dump_url(test->url, &test->u);
fprintf(stderr, "result http_parser_url:\n");
dump_url(test->url, &u);
assert_uint16(test->u.field_set, ==, u.field_set);
assert_uint16(test->u.port, ==, u.port);

assert_memory_equal(sizeof(u), &test->u, &u);
}
} else {
/* test->rv != 0 */
if (rv == 0) {
fprintf(stderr,
"\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, "
"unexpected rv %d ***\n\n",
test->url, test->name, rv);
for (j = 0; j < URLPARSE_MAX; ++j) {
assert_uint16(test->u.field_data[j].off, ==, u.field_data[j].off);
assert_uint16(test->u.field_data[j].len, ==, u.field_data[j].len);

assert_int(test->rv, ==, rv);
if (test->u.field_set & (1 << j)) {
assert_memory_equal(test->u.field_data[j].len,
&test->url[test->u.field_data[j].off],
&test->url[u.field_data[j].off]);
}
}
}
Expand Down
39 changes: 15 additions & 24 deletions urlparse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,23 @@ const MunitSuite urlparse_suite = {
#define assert_field_unset(URL, FIELD) \
assert_false((URL).field_set & (1 << (FIELD)))

/* Copied from https://github.com/nodejs/http-parser */
static void dump_url(const char *url, const urlparse_url *u) {
size_t i;

fprintf(stderr, "\tfield_set: 0x%x, port: %u\n", u->field_set, u->port);
for (i = 0; i < URLPARSE_MAX; i++) {
if ((u->field_set & (1 << i)) == 0) {
fprintf(stderr, "\tfield_data[%zu]: unset\n", i);
continue;
}

fprintf(stderr, "\tfield_data[%zu]: off: %u len: %u part: \"%.*s\"\n", i,
u->field_data[i].off, u->field_data[i].len, u->field_data[i].len,
url + u->field_data[i].off);
}
}

#define assert_url(BUF, U1, U2) \
#define assert_url(BUF, HU, U) \
do { \
if (memcmp((U1), (U2), sizeof(urlparse_url)) == 0) { \
break; \
} \
size_t i; \
\
dump_url((BUF), (urlparse_url *)(U1)); \
dump_url((BUF), (U2)); \
assert_memory_equal(sizeof(urlparse_url), (U1), (U2)); \
assert_uint16((HU)->field_set, ==, (U)->field_set); \
assert_uint16((HU)->port, ==, (U)->port); \
\
for (i = 0; i < URLPARSE_MAX; ++i) { \
assert_uint16((HU)->field_data[i].off, ==, (U)->field_data[i].off); \
assert_uint16((HU)->field_data[i].len, ==, (U)->field_data[i].len); \
\
if ((HU)->field_set & (1 << i)) { \
assert_memory_equal((HU)->field_data[i].len, \
&(BUF)[(HU)->field_data[i].off], \
&(BUF)[(U)->field_data[i].off]); \
} \
} \
} while (0)

void test_urlparse_parse_url(void) {
Expand Down
Loading