mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-28 04:09:31 +03:00
Minor optimisation for MHD_YES/MHD_NO comparison
Comparing against MHD_NO (binary zero) is more efficient
This commit is contained in:
@@ -151,7 +151,7 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
|
||||
ret = MHD_NO;
|
||||
|
||||
free (header);
|
||||
if (MHD_YES == ret)
|
||||
if (MHD_NO != ret)
|
||||
{
|
||||
ret = MHD_queue_response (connection,
|
||||
MHD_HTTP_UNAUTHORIZED,
|
||||
|
||||
+10
-10
@@ -259,7 +259,7 @@ MHD_get_connection_values (struct MHD_Connection *connection,
|
||||
{
|
||||
ret++;
|
||||
if ( (NULL != iterator) &&
|
||||
(MHD_YES != iterator (iterator_cls,
|
||||
(MHD_NO == iterator (iterator_cls,
|
||||
pos->kind,
|
||||
pos->header,
|
||||
pos->value)) )
|
||||
@@ -1333,7 +1333,7 @@ build_header_response (struct MHD_Connection *connection)
|
||||
close the connection */
|
||||
/* 'close' header doesn't exist yet, see if we need to add one;
|
||||
if the client asked for a close, no need to start chunk'ing */
|
||||
if ( (MHD_YES == keepalive_possible (connection)) &&
|
||||
if ( (MHD_NO != keepalive_possible (connection)) &&
|
||||
(MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_1,
|
||||
connection->version) ) )
|
||||
{
|
||||
@@ -1430,7 +1430,7 @@ build_header_response (struct MHD_Connection *connection)
|
||||
#ifdef UPGRADE_SUPPORT
|
||||
(NULL == response->upgrade_handler) &&
|
||||
#endif /* UPGRADE_SUPPORT */
|
||||
(MHD_YES == keepalive_possible (connection)) )
|
||||
(MHD_NO != keepalive_possible (connection)) )
|
||||
must_add_keep_alive = true;
|
||||
break;
|
||||
case MHD_CONNECTION_BODY_SENT:
|
||||
@@ -1631,7 +1631,7 @@ transmit_error_response (struct MHD_Connection *connection,
|
||||
status_code,
|
||||
response);
|
||||
MHD_destroy_response (response);
|
||||
if (MHD_YES != iret)
|
||||
if (MHD_NO == iret)
|
||||
{
|
||||
/* can't even send a reply, at least close the connection */
|
||||
CONNECTION_CLOSE_ERROR (connection,
|
||||
@@ -2426,7 +2426,7 @@ process_request_body (struct MHD_Connection *connection)
|
||||
if (MHD_SIZE_UNKNOWN != connection->remaining_upload_size)
|
||||
connection->remaining_upload_size -= processed_size;
|
||||
}
|
||||
while (MHD_YES == instant_retry);
|
||||
while (MHD_NO != instant_retry);
|
||||
if ( (available > 0) &&
|
||||
(buffer_head != connection->read_buffer) )
|
||||
memmove (connection->read_buffer,
|
||||
@@ -2666,7 +2666,7 @@ parse_connection_headers (struct MHD_Connection *connection)
|
||||
MHD_HTTP_BAD_REQUEST,
|
||||
response);
|
||||
MHD_destroy_response (response);
|
||||
if (MHD_YES != iret)
|
||||
if (MHD_NO == iret)
|
||||
{
|
||||
/* can't even send a reply, at least close the connection */
|
||||
CONNECTION_CLOSE_ERROR (connection,
|
||||
@@ -3012,7 +3012,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
|
||||
if (NULL != response->crc)
|
||||
MHD_mutex_lock_chk_ (&response->mutex);
|
||||
#endif
|
||||
if (MHD_YES != try_ready_normal_body (connection))
|
||||
if (MHD_NO == try_ready_normal_body (connection))
|
||||
{
|
||||
/* mutex was already unlocked by try_ready_normal_body */
|
||||
return;
|
||||
@@ -3494,7 +3494,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
|
||||
{
|
||||
connection->state = MHD_CONNECTION_UPGRADE;
|
||||
/* This connection is "upgraded". Pass socket to application. */
|
||||
if (MHD_YES !=
|
||||
if (MHD_NO ==
|
||||
MHD_response_execute_upgrade_ (connection->response,
|
||||
connection))
|
||||
{
|
||||
@@ -3536,7 +3536,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
|
||||
connection->state = MHD_CONNECTION_BODY_SENT;
|
||||
continue;
|
||||
}
|
||||
if (MHD_YES == try_ready_normal_body (connection))
|
||||
if (MHD_NO != try_ready_normal_body (connection))
|
||||
{
|
||||
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
|
||||
if (NULL != connection->response->crc)
|
||||
@@ -3569,7 +3569,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
|
||||
connection->state = MHD_CONNECTION_BODY_SENT;
|
||||
continue;
|
||||
}
|
||||
if (MHD_YES == try_ready_chunked_body (connection))
|
||||
if (MHD_NO != try_ready_chunked_body (connection))
|
||||
{
|
||||
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
|
||||
if (NULL != connection->response->crc)
|
||||
|
||||
@@ -814,7 +814,7 @@ check_argument_match (struct MHD_Connection *connection,
|
||||
&test_header,
|
||||
&num_headers);
|
||||
free (argb);
|
||||
if (MHD_YES != ret)
|
||||
if (MHD_NO == ret)
|
||||
{
|
||||
return MHD_NO;
|
||||
}
|
||||
@@ -1025,7 +1025,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
|
||||
* Checking if that combination of nonce and nc is sound
|
||||
* and not a replay attack attempt. Also adds the nonce
|
||||
* to the nonce-nc map if it does not exist there.
|
||||
*/if (MHD_YES !=
|
||||
*/if (MHD_NO ==
|
||||
check_nonce_nc (connection,
|
||||
nonce,
|
||||
nci))
|
||||
@@ -1114,7 +1114,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
|
||||
args = "";
|
||||
else
|
||||
args++;
|
||||
if (MHD_YES !=
|
||||
if (MHD_NO ==
|
||||
check_argument_match (connection,
|
||||
args) )
|
||||
{
|
||||
@@ -1363,7 +1363,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
|
||||
realm,
|
||||
&da,
|
||||
nonce);
|
||||
if (MHD_YES !=
|
||||
if (MHD_NO ==
|
||||
check_nonce_nc (connection,
|
||||
nonce,
|
||||
0))
|
||||
@@ -1417,7 +1417,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
|
||||
else
|
||||
ret = MHD_NO;
|
||||
#if 0
|
||||
if ( (MHD_YES == ret) && (AND in state : 100 continue aborting ...))
|
||||
if ( (MHD_NO != ret) && (AND in state : 100 continue aborting ...))
|
||||
ret = MHD_add_response_header (response,
|
||||
MHD_HTTP_HEADER_CONNECTION,
|
||||
"close");
|
||||
@@ -1428,7 +1428,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
|
||||
ret = MHD_NO;
|
||||
}
|
||||
|
||||
if (MHD_YES == ret)
|
||||
if (MHD_NO != ret)
|
||||
{
|
||||
ret = MHD_queue_response (connection,
|
||||
MHD_HTTP_UNAUTHORIZED,
|
||||
|
||||
@@ -213,7 +213,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
|
||||
key_len = daemon->unescape_callback (daemon->unescape_callback_cls,
|
||||
connection,
|
||||
args);
|
||||
if (MHD_YES != cb (connection,
|
||||
if (MHD_NO == cb (connection,
|
||||
args,
|
||||
key_len,
|
||||
NULL,
|
||||
@@ -234,7 +234,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
|
||||
value_len = daemon->unescape_callback (daemon->unescape_callback_cls,
|
||||
connection,
|
||||
equals);
|
||||
if (MHD_YES != cb (connection,
|
||||
if (MHD_NO == cb (connection,
|
||||
args,
|
||||
key_len,
|
||||
equals,
|
||||
@@ -255,7 +255,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
|
||||
key_len = daemon->unescape_callback (daemon->unescape_callback_cls,
|
||||
connection,
|
||||
args);
|
||||
if (MHD_YES != cb (connection,
|
||||
if (MHD_NO == cb (connection,
|
||||
args,
|
||||
key_len,
|
||||
NULL,
|
||||
@@ -279,7 +279,7 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
|
||||
value_len = daemon->unescape_callback (daemon->unescape_callback_cls,
|
||||
connection,
|
||||
equals);
|
||||
if (MHD_YES != cb (connection,
|
||||
if (MHD_NO == cb (connection,
|
||||
args,
|
||||
key_len,
|
||||
equals,
|
||||
|
||||
@@ -262,7 +262,7 @@ MHD_get_response_headers (struct MHD_Response *response,
|
||||
{
|
||||
numHeaders++;
|
||||
if ((NULL != iterator) &&
|
||||
(MHD_YES != iterator (iterator_cls,
|
||||
(MHD_NO == iterator (iterator_cls,
|
||||
pos->kind,
|
||||
pos->header,
|
||||
pos->value)))
|
||||
|
||||
Reference in New Issue
Block a user