HiWilly,
There are two patches for your informationwith patch 0002 is just a typo
fix.
For patch 0001, the orignal code confuses me that why bitwise OR isused
to check if the buffer is empty or not as below:
static inline int buffer_not_empty(const struct buffer *buf)
{
return buf->i | buf->o;
}
In my opinion, buffer_not_empty() returns a bool type, and logical OR is
a better choiceas follow:
static inline int buffer_not_empty(const struct buffer *buf)
{
return buf->i || buf->o;
}
Best Regards,
Godbach
From ecfcee76b3ac4db843dc3c85f168a2c789a4c653 Mon Sep 17 00:00:00 2001
From: Godbach <[email protected]>
Date: Tue, 2 Jul 2013 01:03:15 +0800
Subject: [PATCH 1/2] OPTIM: buffer: use logical OR to check if the buffer is
empty or not
Logical OR should be used instead of bitwise OR in buffer_not_empty() since the
function returns a bool type indeed.
Signed-off-by: Godbach <[email protected]>
---
include/common/buffer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/common/buffer.h b/include/common/buffer.h
index 18ced91..1041ddf 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -154,7 +154,7 @@ static inline int buffer_len(const struct buffer *buf)
/* Return non-zero only if the buffer is not empty */
static inline int buffer_not_empty(const struct buffer *buf)
{
- return buf->i | buf->o;
+ return buf->i || buf->o;
}
/* Return non-zero only if the buffer is empty */
--
1.8.3.1
From 4ba54922f46021f18421633c521bbc9e5c5d4d31 Mon Sep 17 00:00:00 2001
From: Godbach <[email protected]>
Date: Tue, 2 Jul 2013 01:19:15 +0800
Subject: [PATCH 2/2] DOC: minor typo fix in documentation
"http-reqsponse" => "http-response"
Signed-off-by: Godbach <[email protected]>
---
doc/configuration.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/configuration.txt b/doc/configuration.txt
index 8feee6e..5140ff1 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -2875,7 +2875,7 @@ http-response { allow | deny | add-header <name> <fmt> |
set-nice <nice> |
There is no limit to the number of http-response statements per instance.
- It is important to know that http-reqsponse rules are processed very early in
+ It is important to know that http-response rules are processed very early in
the HTTP processing, before "reqdel" or "reqrep" rules. That way, headers
added by "add-header"/"set-header" are visible by almost all further ACL
rules.
--
1.8.3.1