summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_string.h
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-06-25 16:51:47 +0300
committerValentin Bartenev <vbart@nginx.com>2018-06-25 16:51:47 +0300
commit1a52d876f7e10d07f58deee6faeaf70a11a6110f (patch)
treef69ba903180b3deac3bba2ee7acda9d34f18d73c /src/nxt_string.h
parentaf31012815e20f0c92ed6ea803638a16ba47b0c2 (diff)
downloadunit-1a52d876f7e10d07f58deee6faeaf70a11a6110f.tar.gz
unit-1a52d876f7e10d07f58deee6faeaf70a11a6110f.tar.bz2
Introduced nxt_length() macro.
Diffstat (limited to '')
-rw-r--r--src/nxt_string.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nxt_string.h b/src/nxt_string.h
index 2a3d55ea..e6d32fa6 100644
--- a/src/nxt_string.h
+++ b/src/nxt_string.h
@@ -24,7 +24,7 @@ nxt_isdigit(c) \
#define NXT_CR (u_char) 13
#define NXT_LF (u_char) 10
#define NXT_CRLF "\x0d\x0a"
-#define NXT_CRLF_SIZE (sizeof(NXT_CRLF) - 1)
+#define NXT_CRLF_SIZE nxt_length(NXT_CRLF)
#define NXT_LINEFEED_SIZE 1
@@ -116,7 +116,7 @@ typedef struct {
} nxt_str_t;
-#define nxt_string(str) { sizeof(str) - 1, (u_char *) str }
+#define nxt_string(str) { nxt_length(str), (u_char *) str }
#define nxt_string_zero(str) { sizeof(str), (u_char *) str }
#define nxt_null_string { 0, NULL }
@@ -124,7 +124,7 @@ typedef struct {
#define \
nxt_str_set(str, text) \
do { \
- (str)->length = sizeof(text) - 1; \
+ (str)->length = nxt_length(text); \
(str)->start = (u_char *) text; \
} while (0)