diff --git a/CMakeLists.txt b/CMakeLists.txt index f9e1aa8fc3..e98e0c4fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,6 @@ list(APPEND BRPC_COMMON_DEFINITIONS __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS - __STRICT_ANSI__ ) if(WITH_ASAN) diff --git a/src/brpc/policy/http2_rpc_protocol.cpp b/src/brpc/policy/http2_rpc_protocol.cpp index 6d9b2b8714..060b25faf1 100644 --- a/src/brpc/policy/http2_rpc_protocol.cpp +++ b/src/brpc/policy/http2_rpc_protocol.cpp @@ -1683,6 +1683,22 @@ bool H2Context::FlushPendingData(int stream_id) { return out.empty() || WriteAck(_socket, &out) == 0; } +H2UnsentRequest::H2UnsentRequest(Controller* c) + : _nref(1) + , _size(0) + , _stream_id(0) + , _cntl(c) { +#ifndef NDEBUG + get_h2_bvars()->h2_unsent_request_count << 1; +#endif +} + +H2UnsentRequest::~H2UnsentRequest() { +#ifndef NDEBUG + get_h2_bvars()->h2_unsent_request_count << -1; +#endif +} + H2UnsentRequest* H2UnsentRequest::New(Controller* c) { const HttpHeader& h = c->http_request(); const CommonStrings* const common = get_common_strings(); diff --git a/src/brpc/policy/http2_rpc_protocol.h b/src/brpc/policy/http2_rpc_protocol.h index 64c9864d68..b82dd93f55 100644 --- a/src/brpc/policy/http2_rpc_protocol.h +++ b/src/brpc/policy/http2_rpc_protocol.h @@ -165,20 +165,8 @@ friend void PackH2Request(butil::IOBuf*, SocketMessage**, void push(const std::string& name, const std::string& value) { new (&_list[_size++]) HPacker::Header(name, value); } - H2UnsentRequest(Controller* c) - : _nref(1) - , _size(0) - , _stream_id(0) - , _cntl(c) { -#ifndef NDEBUG - get_h2_bvars()->h2_unsent_request_count << 1; -#endif - } - ~H2UnsentRequest() { -#ifndef NDEBUG - get_h2_bvars()->h2_unsent_request_count << -1; -#endif - } + H2UnsentRequest(Controller* c); + ~H2UnsentRequest(); H2UnsentRequest(const H2UnsentRequest&); void operator=(const H2UnsentRequest&); void Destroy();