Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cleanup: unused warning #3801

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

Merged
merged 5 commits into from
Jun 1, 2016
Merged

cleanup: unused warning #3801

merged 5 commits into from
Jun 1, 2016

Conversation

ethomson
Copy link
Member

@ethomson ethomson commented May 26, 2016

Gonna let this run on the CI bots to see what else is out there.

@ethomson
Copy link
Member Author

These are relatively straightforward - the exception being c3ba162 - it would be great if you could sanity-check me on that @carlosmn

@carlosmn
Copy link
Member

The docs for libcurl say we should be passing in a certinfo https://curl.haxx.se/libcurl/c/CURLINFO_CERTINFO.html although the example uses an union of both types https://curl.haxx.se/libcurl/c/certinfo.html so it looks like what we actually need is just a cast, because the example does imply we're getting a certinfo rather than a list.

@ethomson
Copy link
Member Author

WTF. The docs for curl_easy_getinfo say the opposite and that we should be using a struct_curl_slist *.

https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html

@carlosmn
Copy link
Member

The signature on that page says CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... ); and it matches what's in the headers in my system curl, so the compiler shouldn't care what we put it. I'm not sure where you're getting the list from.

@ethomson
Copy link
Member Author

I don't think that I understand your question. What list are you talking about? The curl_slist *? From the man page that I linked to:

The third argument MUST be a pointer to a long, a pointer to a char *, a pointer to a struct curl_slist * or a pointer to a double (as this documentation describes further down)

And this is enforced by https://github.com/curl/curl/blob/master/include/curl/typecheck-gcc.h#L111

It so happens that the struct curl_slist * is the first member of the struct curl_certinfo. And that internally curl happens to be setting that pointer to a struct curl_certinfo - which means of course we can safely use either, at least as long as the implementation remains as-is. My argument was that we shouldn't rely on an implementation detail, even though (of course) they will. Though this is quite a stupid situation to have two pieces of documentation that disagree with each other and an example that doesn't really make any sense (but of course works because it was written with knowledge of the internal state).

Anyway, I opened curl/curl#846 but I don't think that this really impacts us. We're walking the list, we don't actually need knowledge of the number of certs. We can treat that arg as a struct curl_slist * and be correct, honor half the documentation and the header in question, and that's what we should do.

But again, maybe I didn't understand your question.

Edward Thomson added 5 commits June 1, 2016 10:03
It looks like we're getting the operation and not doing anything
with it, when in fact we are asserting that it's not null.  Simply
assert that we are within the operation boundary instead of using
the `git_array_get` macro to do this for us.
@ethomson
Copy link
Member Author

ethomson commented Jun 1, 2016

curl has clarified that struct curl_certinfo * is indeed allowable, I dropped that commit changing it to a struct curl_slist *.

@ethomson ethomson merged commit efb432c into libgit2:master Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants