mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-02 06:51:53 -06:00
curl: Remove unnecessary use of goto
This isn't any of the usually acceptable uses of goto. Signed-off-by: Matthew Booth <mbooth@redhat.com> Tested-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
f6246509be
commit
9e550b3260
1 changed files with 26 additions and 27 deletions
13
block/curl.c
13
block/curl.c
|
@ -343,15 +343,15 @@ static CURLState *curl_init_state(BDRVCURLState *s)
|
||||||
}
|
}
|
||||||
} while(!state);
|
} while(!state);
|
||||||
|
|
||||||
if (state->curl)
|
if (!state->curl) {
|
||||||
goto has_curl;
|
|
||||||
|
|
||||||
state->curl = curl_easy_init();
|
state->curl = curl_easy_init();
|
||||||
if (!state->curl)
|
if (!state->curl) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
curl_easy_setopt(state->curl, CURLOPT_URL, s->url);
|
curl_easy_setopt(state->curl, CURLOPT_URL, s->url);
|
||||||
curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5);
|
curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5);
|
||||||
curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb);
|
curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION,
|
||||||
|
(void *)curl_read_cb);
|
||||||
curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state);
|
curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state);
|
||||||
curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state);
|
curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state);
|
||||||
curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1);
|
curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1);
|
||||||
|
@ -374,8 +374,7 @@ static CURLState *curl_init_state(BDRVCURLState *s)
|
||||||
#ifdef DEBUG_VERBOSE
|
#ifdef DEBUG_VERBOSE
|
||||||
curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1);
|
curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
has_curl:
|
|
||||||
|
|
||||||
state->s = s;
|
state->s = s;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue