mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
http: suppress "flags may be used uninitialized in this function" error
Some GCC reports [1]: /home/runner/work/libevent/libevent/http.c: In function ‘evhttp_make_header’: /home/runner/work/libevent/libevent/http.c:503:14: error: ‘flags’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ev_uint16_t flags; ^~~~~ /home/runner/work/libevent/libevent/http.c: In function ‘evhttp_get_body’: /home/runner/work/libevent/libevent/http.c:2354:14: error: ‘flags’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ev_uint16_t flags; ^~~~~ [1]: https://github.com/libevent/libevent/runs/7263518338?check_suite_focus=true#logs
This commit is contained in:
parent
3960449374
commit
c8501afc0c
6
http.c
6
http.c
@ -500,7 +500,8 @@ evhttp_make_header_request(struct evhttp_connection *evcon,
|
|||||||
struct evhttp_request *req)
|
struct evhttp_request *req)
|
||||||
{
|
{
|
||||||
const char *method;
|
const char *method;
|
||||||
ev_uint16_t flags;
|
/* NOTE: some version of GCC reports a warning that flags may be uninitialized, hence assignment */
|
||||||
|
ev_uint16_t flags = 0;
|
||||||
|
|
||||||
evhttp_remove_header(req->output_headers, "Proxy-Connection");
|
evhttp_remove_header(req->output_headers, "Proxy-Connection");
|
||||||
|
|
||||||
@ -2351,7 +2352,8 @@ evhttp_get_body_length(struct evhttp_request *req)
|
|||||||
static int
|
static int
|
||||||
evhttp_method_may_have_body_(struct evhttp_connection *evcon, enum evhttp_cmd_type type)
|
evhttp_method_may_have_body_(struct evhttp_connection *evcon, enum evhttp_cmd_type type)
|
||||||
{
|
{
|
||||||
ev_uint16_t flags;
|
/* NOTE: some version of GCC reports a warning that flags may be uninitialized, hence assignment */
|
||||||
|
ev_uint16_t flags = 0;
|
||||||
evhttp_method_(evcon, type, &flags);
|
evhttp_method_(evcon, type, &flags);
|
||||||
return (flags & EVHTTP_METHOD_HAS_BODY) ? 1 : 0;
|
return (flags & EVHTTP_METHOD_HAS_BODY) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user