Removed '\r' and '\n' artifact macros.
This commit is contained in:
@@ -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);
|
p = log->ctx_handler(log->ctx, p, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p > end - NXT_LINEFEED_SIZE) {
|
if (p > end - nxt_length("\n")) {
|
||||||
p = end - NXT_LINEFEED_SIZE;
|
p = end - nxt_length("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
nxt_linefeed(p);
|
*p++ = '\n';
|
||||||
|
|
||||||
(void) nxt_write_console(nxt_stderr, msg, p - msg);
|
(void) nxt_write_console(nxt_stderr, msg, p - msg);
|
||||||
|
|
||||||
if (level == NXT_LOG_ALERT) {
|
if (level == NXT_LOG_ALERT) {
|
||||||
*(p - NXT_LINEFEED_SIZE) = '\0';
|
*(p - nxt_length("\n")) = '\0';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The syslog LOG_ALERT level is enough, because
|
* The syslog LOG_ALERT level is enough, because
|
||||||
|
|||||||
@@ -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 (b = fsr->parse.out[1]; b != NULL; b = b->next) {
|
||||||
|
|
||||||
for (p = b->mem.free - 1; p >= b->mem.pos; p--) {
|
for (p = b->mem.free - 1; p >= b->mem.pos; p--) {
|
||||||
if (*p != NXT_CR && *p != NXT_LF) {
|
if (*p != '\r' && *p != '\n') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp,
|
|||||||
if (nxt_fast_path(c <= 5)) {
|
if (nxt_fast_path(c <= 5)) {
|
||||||
c += 0x0A;
|
c += 0x0A;
|
||||||
|
|
||||||
} else if (nxt_fast_path(ch == NXT_CR)) {
|
} else if (nxt_fast_path(ch == '\r')) {
|
||||||
state = sw_chunk_size_linefeed;
|
state = sw_chunk_size_linefeed;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp,
|
|||||||
goto chunk_error;
|
goto chunk_error;
|
||||||
|
|
||||||
case sw_chunk_size_linefeed:
|
case sw_chunk_size_linefeed:
|
||||||
if (nxt_fast_path(ch == NXT_LF)) {
|
if (nxt_fast_path(ch == '\n')) {
|
||||||
|
|
||||||
if (hcp->chunk_size != 0) {
|
if (hcp->chunk_size != 0) {
|
||||||
state = sw_chunk;
|
state = sw_chunk;
|
||||||
@@ -137,7 +137,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp,
|
|||||||
goto chunk_error;
|
goto chunk_error;
|
||||||
|
|
||||||
case sw_chunk_end_newline:
|
case sw_chunk_end_newline:
|
||||||
if (nxt_fast_path(ch == NXT_CR)) {
|
if (nxt_fast_path(ch == '\r')) {
|
||||||
state = sw_chunk_end_linefeed;
|
state = sw_chunk_end_linefeed;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp,
|
|||||||
goto chunk_error;
|
goto chunk_error;
|
||||||
|
|
||||||
case sw_chunk_end_linefeed:
|
case sw_chunk_end_linefeed:
|
||||||
if (nxt_fast_path(ch == NXT_LF)) {
|
if (nxt_fast_path(ch == '\n')) {
|
||||||
|
|
||||||
if (!hcp->last) {
|
if (!hcp->last) {
|
||||||
state = sw_start;
|
state = sw_start;
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rp->method.start == p && (ch == NXT_CR || ch == NXT_LF)) {
|
if (rp->method.start == p && (ch == '\r' || ch == '\n')) {
|
||||||
rp->method.start++;
|
rp->method.start++;
|
||||||
p++;
|
p++;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -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);
|
p = log->ctx_handler(log->ctx, p, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p > end - NXT_LINEFEED_SIZE) {
|
if (p > end - nxt_length("\n")) {
|
||||||
p = end - NXT_LINEFEED_SIZE;
|
p = end - nxt_length("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
nxt_linefeed(p);
|
*p++ = '\n';
|
||||||
|
|
||||||
(void) nxt_write_console(nxt_stderr, msg, p - msg);
|
(void) nxt_write_console(nxt_stderr, msg, p - msg);
|
||||||
|
|
||||||
if (level == NXT_LOG_ALERT) {
|
if (level == NXT_LOG_ALERT) {
|
||||||
*(p - NXT_LINEFEED_SIZE) = '\0';
|
*(p - nxt_length("\n")) = '\0';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Syslog LOG_ALERT level is enough, because
|
* Syslog LOG_ALERT level is enough, because
|
||||||
|
|||||||
@@ -1233,7 +1233,7 @@ nxt_runtime_pid_file_create(nxt_task_t *task, nxt_file_name_t *pid_file)
|
|||||||
ssize_t length;
|
ssize_t length;
|
||||||
nxt_int_t n;
|
nxt_int_t n;
|
||||||
nxt_file_t file;
|
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));
|
nxt_memzero(&file, sizeof(nxt_file_t));
|
||||||
|
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
*buf++ = NXT_LF;
|
*buf++ = '\n';
|
||||||
fmt++;
|
fmt++;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ nxt_str_strip(u_char *start, u_char *end)
|
|||||||
u_char *p;
|
u_char *p;
|
||||||
|
|
||||||
for (p = end - 1; p >= start; p--) {
|
for (p = end - 1; p >= start; p--) {
|
||||||
if (*p != NXT_CR && *p != NXT_LF) {
|
if (*p != '\r' && *p != '\n') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,19 +21,6 @@ nxt_isdigit(c) \
|
|||||||
((u_char) ((c) - '0') <= 9)
|
((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 \
|
#define \
|
||||||
nxt_strlen(s) \
|
nxt_strlen(s) \
|
||||||
strlen((char *) s)
|
strlen((char *) s)
|
||||||
|
|||||||
Reference in New Issue
Block a user