Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: use calculated offsets than integer literals for HTTP header parsing #7032

Conversation

@starrify
Copy link
Contributor

@starrify starrify commented May 8, 2021

I was reading some code in lib/http.c (rather irrelevant to this PR) to understand curl's implement when I happened to notice the offset values in integer literals (e.g. headp + 15). Therefore the motivation of this PR.

Local tests on my machine (GNU/Linux x86_64 with gcc) before the change (at 1763ace):

TESTDONE: 1425 tests were considered during 1506 seconds.
TESTDONE: 1146 tests out of 1149 reported OK: 99%
TESTFAIL: These test cases failed: 1700 1701 1702

And after the change (at 2f7b2aa):

TESTDONE: 1425 tests were considered during 1518 seconds.
TESTDONE: 1146 tests out of 1149 reported OK: 99%
TESTFAIL: These test cases failed: 1700 1701 1702

I have got a quick look at those failed tests, which seemed unrelated to the changes here.

…rsing

Assumed to be a minor coding style improvement with no behavior change.

A modern compiler is expected to have the calculation optimized during
compilation. It may be deemed okay even if that's not the case, since
the added overhead is considered very low.
@deepcode-ci-bot
Copy link

@deepcode-ci-bot deepcode-ci-bot bot commented May 8, 2021

DeepCode failed to analyze this pull request

Something went wrong despite trying multiple times, sorry about that.
Please comment this pull request with "Retry DeepCode" to manually retry, or contact us so that a human can look into the issue.

Copy link
Member

@bagder bagder left a comment

Improved readability is good! 👍

@bagder bagder closed this in dbb8852 May 8, 2021
@bagder
Copy link
Member

@bagder bagder commented May 8, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants