mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:43:33 +03:00
misc: reduce strlen() calls with Curl_dyn_add()
Use STRCONST() to switch from Curl_dyn_add() to Curl_dyn_addn() for string literals. Closes #8398
This commit is contained in:
parent
2a1951519e
commit
b807219292
7 changed files with 37 additions and 34 deletions
10
lib/http2.c
10
lib/http2.c
|
|
@ -758,7 +758,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
|
|||
stream->status_code = -1;
|
||||
}
|
||||
|
||||
result = Curl_dyn_add(&stream->header_recvbuf, "\r\n");
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, STRCONST("\r\n"));
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
|
||||
|
|
@ -1081,14 +1081,14 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
|
|||
stream->status_code = decode_status_code(value, valuelen);
|
||||
DEBUGASSERT(stream->status_code != -1);
|
||||
|
||||
result = Curl_dyn_add(&stream->header_recvbuf, "HTTP/2 ");
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, STRCONST("HTTP/2 "));
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, value, valuelen);
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
/* the space character after the status code is mandatory */
|
||||
result = Curl_dyn_add(&stream->header_recvbuf, " \r\n");
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, STRCONST(" \r\n"));
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
/* if we receive data for another handle, wake that up */
|
||||
|
|
@ -1106,13 +1106,13 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
|
|||
result = Curl_dyn_addn(&stream->header_recvbuf, name, namelen);
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
result = Curl_dyn_add(&stream->header_recvbuf, ": ");
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, STRCONST(": "));
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, value, valuelen);
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
result = Curl_dyn_add(&stream->header_recvbuf, "\r\n");
|
||||
result = Curl_dyn_addn(&stream->header_recvbuf, STRCONST("\r\n"));
|
||||
if(result)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
/* if we receive data for another handle, wake that up */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue