diff options
-rw-r--r-- | src/nxt_app_log.c | 8 | ||||
-rw-r--r-- | src/nxt_fastcgi_source.c | 2 | ||||
-rw-r--r-- | src/nxt_http_chunk_parse.c | 8 | ||||
-rw-r--r-- | src/nxt_http_parse.c | 2 | ||||
-rw-r--r-- | src/nxt_log.c | 8 | ||||
-rw-r--r-- | src/nxt_runtime.c | 2 | ||||
-rw-r--r-- | src/nxt_sprintf.c | 2 | ||||
-rw-r--r-- | src/nxt_string.c | 2 | ||||
-rw-r--r-- | src/nxt_string.h | 13 |
9 files changed, 17 insertions, 30 deletions
diff --git a/src/nxt_app_log.c b/src/nxt_app_log.c index 16649ecf..83eac371 100644 --- a/src/nxt_app_log.c +++ b/src/nxt_app_log.c @@ -71,16 +71,16 @@ nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...) p = log->ctx_handler(log->ctx, p, end); } - if (p > end - NXT_LINEFEED_SIZE) { - p = end - NXT_LINEFEED_SIZE; + if (p > end - nxt_length("\n")) { + p = end - nxt_length("\n"); } - nxt_linefeed(p); + *p++ = '\n'; (void) nxt_write_console(nxt_stderr, msg, p - msg); if (level == NXT_LOG_ALERT) { - *(p - NXT_LINEFEED_SIZE) = '\0'; + *(p - nxt_length("\n")) = '\0'; /* * The syslog LOG_ALERT level is enough, because diff --git a/src/nxt_fastcgi_source.c b/src/nxt_fastcgi_source.c index 068c00a9..b1be3303 100644 --- a/src/nxt_fastcgi_source.c +++ b/src/nxt_fastcgi_source.c @@ -424,7 +424,7 @@ nxt_fastcgi_source_record_filter(nxt_task_t *task, void *obj, void *data) for (b = fsr->parse.out[1]; b != NULL; b = b->next) { for (p = b->mem.free - 1; p >= b->mem.pos; p--) { - if (*p != NXT_CR && *p != NXT_LF) { + if (*p != '\r' && *p != '\n') { break; } } diff --git a/src/nxt_http_chunk_parse.c b/src/nxt_http_chunk_parse.c index 83bb4965..644b9805 100644 --- a/src/nxt_http_chunk_parse.c +++ b/src/nxt_http_chunk_parse.c @@ -105,7 +105,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp, if (nxt_fast_path(c <= 5)) { c += 0x0A; - } else if (nxt_fast_path(ch == NXT_CR)) { + } else if (nxt_fast_path(ch == '\r')) { state = sw_chunk_size_linefeed; continue; @@ -122,7 +122,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp, goto chunk_error; case sw_chunk_size_linefeed: - if (nxt_fast_path(ch == NXT_LF)) { + if (nxt_fast_path(ch == '\n')) { if (hcp->chunk_size != 0) { state = sw_chunk; @@ -137,7 +137,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp, goto chunk_error; case sw_chunk_end_newline: - if (nxt_fast_path(ch == NXT_CR)) { + if (nxt_fast_path(ch == '\r')) { state = sw_chunk_end_linefeed; continue; } @@ -145,7 +145,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp, goto chunk_error; case sw_chunk_end_linefeed: - if (nxt_fast_path(ch == NXT_LF)) { + if (nxt_fast_path(ch == '\n')) { if (!hcp->last) { state = sw_start; diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c index 7aa5f53f..b9325c57 100644 --- a/src/nxt_http_parse.c +++ b/src/nxt_http_parse.c @@ -227,7 +227,7 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos, continue; } - if (rp->method.start == p && (ch == NXT_CR || ch == NXT_LF)) { + if (rp->method.start == p && (ch == '\r' || ch == '\n')) { rp->method.start++; p++; continue; diff --git a/src/nxt_log.c b/src/nxt_log.c index 992c3205..1c666961 100644 --- a/src/nxt_log.c +++ b/src/nxt_log.c @@ -92,16 +92,16 @@ nxt_log_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...) p = log->ctx_handler(log->ctx, p, end); } - if (p > end - NXT_LINEFEED_SIZE) { - p = end - NXT_LINEFEED_SIZE; + if (p > end - nxt_length("\n")) { + p = end - nxt_length("\n"); } - nxt_linefeed(p); + *p++ = '\n'; (void) nxt_write_console(nxt_stderr, msg, p - msg); if (level == NXT_LOG_ALERT) { - *(p - NXT_LINEFEED_SIZE) = '\0'; + *(p - nxt_length("\n")) = '\0'; /* * Syslog LOG_ALERT level is enough, because diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index b72cd7d8..4923c965 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -1233,7 +1233,7 @@ nxt_runtime_pid_file_create(nxt_task_t *task, nxt_file_name_t *pid_file) ssize_t length; nxt_int_t n; nxt_file_t file; - u_char pid[NXT_INT64_T_LEN + NXT_LINEFEED_SIZE]; + u_char pid[NXT_INT64_T_LEN + nxt_length("\n")]; nxt_memzero(&file, sizeof(nxt_file_t)); diff --git a/src/nxt_sprintf.c b/src/nxt_sprintf.c index f2e2b414..0b387883 100644 --- a/src/nxt_sprintf.c +++ b/src/nxt_sprintf.c @@ -522,7 +522,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args) continue; case 'n': - *buf++ = NXT_LF; + *buf++ = '\n'; fmt++; continue; diff --git a/src/nxt_string.c b/src/nxt_string.c index 8225cd9b..1858b58b 100644 --- a/src/nxt_string.c +++ b/src/nxt_string.c @@ -308,7 +308,7 @@ nxt_str_strip(u_char *start, u_char *end) u_char *p; for (p = end - 1; p >= start; p--) { - if (*p != NXT_CR && *p != NXT_LF) { + if (*p != '\r' && *p != '\n') { break; } } diff --git a/src/nxt_string.h b/src/nxt_string.h index e6d32fa6..5f82cca8 100644 --- a/src/nxt_string.h +++ b/src/nxt_string.h @@ -21,19 +21,6 @@ nxt_isdigit(c) \ ((u_char) ((c) - '0') <= 9) -#define NXT_CR (u_char) 13 -#define NXT_LF (u_char) 10 -#define NXT_CRLF "\x0d\x0a" -#define NXT_CRLF_SIZE nxt_length(NXT_CRLF) - - -#define NXT_LINEFEED_SIZE 1 - -#define \ -nxt_linefeed(p) \ - *p++ = NXT_LF - - #define \ nxt_strlen(s) \ strlen((char *) s) |