diff options
author | Yang Tse <yangsita@gmail.com> | 2012-12-29 02:57:08 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-12-29 22:17:06 +0100 |
commit | f947de4bb5c2d41ffd35f047c1f878820639c26a (patch) | |
tree | 9bdfd21077657cf2e03f974aa0c4067f8ae2935b | |
parent | 2424b7ab1b4fb4fa7b663595c73305db2898da38 (diff) |
examples/certinfo.c: fix compiler warning
-rw-r--r-- | docs/examples/certinfo.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/docs/examples/certinfo.c b/docs/examples/certinfo.c index ffcec6356..ac0109b07 100644 --- a/docs/examples/certinfo.c +++ b/docs/examples/certinfo.c @@ -52,18 +52,24 @@ int main(void) res = curl_easy_perform(curl); if(!res) { - struct curl_certinfo *ci = NULL; + union { + struct curl_slist *to_info; + struct curl_certinfo *to_certinfo; + } ptr; - res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); + ptr.to_info = NULL; - if(!res && ci) { + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ptr.to_info); + + if(!res && ptr.to_info) { int i; - printf("%d certs!\n", ci->num_of_certs); - for(i=0; i<ci->num_of_certs; i++) { + printf("%d certs!\n", ptr.to_certinfo->num_of_certs); + + for(i = 0; i < ptr.to_certinfo->num_of_certs; i++) { struct curl_slist *slist; - for(slist = ci->certinfo[i]; slist; slist = slist->next) + for(slist = ptr.to_certinfo->certinfo[i]; slist; slist = slist->next) printf("%s\n", slist->data); } @@ -71,7 +77,6 @@ int main(void) } - curl_easy_cleanup(curl); } |