[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: Minor optimisation for MHD_YES/MH
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: Minor optimisation for MHD_YES/MHD_NO comparison Comparing against MHD_NO (binary zero) is more efficient |
Date: |
Sun, 20 Sep 2020 14:37:25 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new 669ddcc0 Minor optimisation for MHD_YES/MHD_NO comparison Comparing
against MHD_NO (binary zero) is more efficient
669ddcc0 is described below
commit 669ddcc0a2bb288f800bc27313dc568d369c3b2d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Sep 20 14:38:31 2020 +0300
Minor optimisation for MHD_YES/MHD_NO comparison
Comparing against MHD_NO (binary zero) is more efficient
---
src/microhttpd/basicauth.c | 2 +-
src/microhttpd/connection.c | 20 ++++++++++----------
src/microhttpd/digestauth.c | 12 ++++++------
src/microhttpd/internal.c | 8 ++++----
src/microhttpd/response.c | 2 +-
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index d9532d4a..d39019f5 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -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,
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 02497cc6..f9f15cec 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -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)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index d8d3b4ea..c3260d1b 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -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,
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index ba601fa0..33542c4a 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -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,
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 27b3ee3f..141372b9 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -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)))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: Minor optimisation for MHD_YES/MHD_NO comparison Comparing against MHD_NO (binary zero) is more efficient,
gnunet <=