Home
last modified time | relevance | path

Searched hist:20 (Results 126 – 150 of 369) sorted by path

12345678910>>...15

/unit/src/
H A Dnxt_http_parse.hdiff 2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
diff 2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
diff 67:5bde485f693f Tue Jun 20 19:32:00 UTC 2017 Valentin Bartenev <vbart@nginx.com> HTTP parser: reduced memory consumption of header fields list.
diff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
H A Dnxt_http_proxy.cdiff 1394:20b41ebfff79 Fri Mar 06 15:28:00 UTC 2020 Igor Sysoev <igor@sysoev.ru> Round robin upstream added.
H A Dnxt_http_request.cdiff 2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
diff 2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
diff 2247:baa6b9879267 Sun Nov 20 15:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Basic njs support.
diff 2246:5f4056478375 Sun Nov 20 15:15:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.
diff 2147:7bf58b1b18c4 Wed Jul 13 20:32:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: dynamic variables support.

This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
diff 2133:46433e3cef45 Mon Jun 20 05:22:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Router: forwared header replacement.
diff 2132:34d63ed988dc Mon Jun 20 05:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Router: introduced nxt_http_forward_t.

This makes the replacement of forwarded request header
like client_ip and protocol more generic.
It's a prerequirement for protocol replacement.

No functional changes.
diff 1131:ec7d924d8dfb Tue Aug 20 13:31:00 UTC 2019 Max Romanov <max.romanov@nginx.com> Introducing websocket support in router and libunit.
H A Dnxt_http_response.cdiff 1131:ec7d924d8dfb Tue Aug 20 13:31:00 UTC 2019 Max Romanov <max.romanov@nginx.com> Introducing websocket support in router and libunit.
H A Dnxt_http_return.cdiff 2247:baa6b9879267 Sun Nov 20 15:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Basic njs support.
diff 2246:5f4056478375 Sun Nov 20 15:15:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.
diff 2147:7bf58b1b18c4 Wed Jul 13 20:32:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: dynamic variables support.

This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
diff 2102:9ad9385c16e1 Mon May 16 22:20:00 UTC 2022 Alejandro Colomar <alx.manpages@gmail.com> Wrapped debug code in '#if (NXT_DEBUG)'.
diff 1432:f650ced3012a Fri Mar 20 22:39:00 UTC 2020 Valentin Bartenev <vbart@nginx.com> Implemented "location" option for "return" action.

This allows to specify redirects:

{
"action": {
"return": 301,
"location": "https://www.example.com/"
}
}
H A Dnxt_http_rewrite.c2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
H A Dnxt_http_route.cdiff 2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
diff 2448:243735980417 Thu Apr 20 15:20:00 UTC 2023 Zhidao HONG <z.hong@f5.com> HTTP: added basic URI rewrite.

This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd.
An example:
"routes": [
{
"match": {
"uri": "/v1/test"
},
"action": {
"return": 200
}
},
{
"action": {
"rewrite": "/v1$uri",
"pass": "routes"
}
}
]

Reviewed-by: Alejandro Colomar <alx@nginx.com>
diff 2247:baa6b9879267 Sun Nov 20 15:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Basic njs support.
diff 2246:5f4056478375 Sun Nov 20 15:15:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.
diff 2232:1fb2182a4d03 Wed Nov 02 20:45:00 UTC 2022 Alejandro Colomar <alx@nginx.com> Removed the unsafe nxt_memchr() wrapper for memchr(3).

The casts are unnecessary, since memchr(3)'s argument is 'const void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can
hide all classes of bugs by silencing most compiler warnings.

The changes from nxt_memchr() to memchr(3) were scripted:

$ find src/ -type f \
| grep '\.[ch]$' \
| xargs sed -i 's/nxt_memchr/memchr/'

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
diff 2231:5b3a69fd47a7 Wed Nov 02 20:45:00 UTC 2022 Alejandro Colomar <alx@nginx.com> Removed the unsafe nxt_memcmp() wrapper for memcmp(3).

The casts are unnecessary, since memcmp(3)'s arguments are 'void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can
hide all classes of bugs by silencing most compiler warnings.

The changes from nxt_memcmp() to memcmp(3) were scripted:

$ find src/ -type f \
| grep '\.[ch]$' \
| xargs sed -i 's/nxt_memcmp/memcmp/'

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
diff 2147:7bf58b1b18c4 Wed Jul 13 20:32:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: dynamic variables support.

This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
diff 2133:46433e3cef45 Mon Jun 20 05:22:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Router: forwared header replacement.
diff 1432:f650ced3012a Fri Mar 20 22:39:00 UTC 2020 Valentin Bartenev <vbart@nginx.com> Implemented "location" option for "return" action.

This allows to specify redirects:

{
"action": {
"return": 301,
"location": "https://www.example.com/"
}
}
diff 1394:20b41ebfff79 Fri Mar 06 15:28:00 UTC 2020 Igor Sysoev <igor@sysoev.ru> Round robin upstream added.
H A Dnxt_http_route_addr.cdiff 2232:1fb2182a4d03 Wed Nov 02 20:45:00 UTC 2022 Alejandro Colomar <alx@nginx.com> Removed the unsafe nxt_memchr() wrapper for memchr(3).

The casts are unnecessary, since memchr(3)'s argument is 'const void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can
hide all classes of bugs by silencing most compiler warnings.

The changes from nxt_memchr() to memchr(3) were scripted:

$ find src/ -type f \
| grep '\.[ch]$' \
| xargs sed -i 's/nxt_memchr/memchr/'

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
diff 2231:5b3a69fd47a7 Wed Nov 02 20:45:00 UTC 2022 Alejandro Colomar <alx@nginx.com> Removed the unsafe nxt_memcmp() wrapper for memcmp(3).

The casts are unnecessary, since memcmp(3)'s arguments are 'void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can
hide all classes of bugs by silencing most compiler warnings.

The changes from nxt_memcmp() to memcmp(3) were scripted:

$ find src/ -type f \
| grep '\.[ch]$' \
| xargs sed -i 's/nxt_memcmp/memcmp/'

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
diff 2160:5779bf989b96 Wed Jun 15 15:20:00 UTC 2022 Andrew Clayton <andrew@digital-domain.net> Router: avoided undefined behaviour.

In src/nxt_http_route_addr.c::nxt_http_route_addr_pattern_parse() there
was potentially undefined behaviour when shifting a 32 bit value by 32
bits, this could happen if cidr_prefix was 0.

Promote the shiftee to unsigned long long to avoid this issue.
H A Dnxt_http_static.cdiff 2247:baa6b9879267 Sun Nov 20 15:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Basic njs support.
diff 2246:5f4056478375 Sun Nov 20 15:15:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.
diff 2147:7bf58b1b18c4 Wed Jul 13 20:32:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: dynamic variables support.

This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
diff 1617:c1f6f719cf1d Tue Sep 29 20:23:00 UTC 2020 Valentin Bartenev <vbart@nginx.com> MIME: added AVIF and APNG image formats.

AVIF is a modern image format based on the AV1 video codec. It generally has
better compression than other widely used formats (WebP, JPEG, PNG, and GIF)
and is designed to supersede them. Support was already added to the latest
version of Chrome.

APNG extends PNG to permit animated images that work similarly to animated GIF.
It's supported by most modern browsers.

Also removed duplicated ".svg" entry.
diff 1483:850e3a95c4e7 Wed May 20 08:18:00 UTC 2020 Valentin Bartenev <vbart@nginx.com> Static: fixed potential undefined behavior in memcpy().

According to the C standard, pointer arguments passed to memcpy() calls shall
still have valid values. NULL is considered as invalid.

Found with GCC Static Analyzer.
diff 1198:c42525ede054 Fri Sep 20 11:31:00 UTC 2019 Valentin Bartenev <vbart@nginx.com> Fixed segfault if an inappropriate file system object is requested.

Found by Coverity (CID 349483).
H A Dnxt_http_variables.cdiff 2246:5f4056478375 Sun Nov 20 15:15:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.
diff 2231:5b3a69fd47a7 Wed Nov 02 20:45:00 UTC 2022 Alejandro Colomar <alx@nginx.com> Removed the unsafe nxt_memcmp() wrapper for memcmp(3).

The casts are unnecessary, since memcmp(3)'s arguments are 'void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can
hide all classes of bugs by silencing most compiler warnings.

The changes from nxt_memcmp() to memcmp(3) were scripted:

$ find src/ -type f \
| grep '\.[ch]$' \
| xargs sed -i 's/nxt_memcmp/memcmp/'

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
diff 2149:7a53238e050d Wed Jul 13 20:34:00 UTC 2022 Zhidao HONG <z.hong@f5.com> HTTP: added more variables.

This commit adds the following variables:
$remote_addr, $time_local, $request_line, $status,
$body_bytes_sent, $header_referer, $header_user_agent.
diff 2147:7bf58b1b18c4 Wed Jul 13 20:32:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Var: dynamic variables support.

This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
H A Dnxt_http_websocket.cdiff 1555:1d84b9e4b459 Tue Aug 11 16:20:00 UTC 2020 Max Romanov <max.romanov@nginx.com> Introducing application and port shared memory queues.

The goal is to minimize the number of syscalls needed to deliver a message.
diff 1547:cbcd76704c90 Tue Aug 11 16:20:00 UTC 2020 Max Romanov <max.romanov@nginx.com> Introducing the shared application port.

This is the port shared between all application processes which use it to pass
requests for processing. Using it significantly simplifies the request
processing code in the router. The drawback is 2 more file descriptors per each
configured application and more complex libunit message wait/read code.
diff 1546:06017e6e3a5f Tue Aug 11 16:20:00 UTC 2020 Max Romanov <max.romanov@nginx.com> Changing router to application shared memory exchange protocol.

The application process needs to request the shared memory segment from the
router instead of the latter pushing the segment before sending a request to
the application. This is required to simplify the communication between the
router and the application and to prepare the router for using the application
shared port and then the queue.
1131:ec7d924d8dfb Tue Aug 20 13:31:00 UTC 2019 Max Romanov <max.romanov@nginx.com> Introducing websocket support in router and libunit.
H A Dnxt_isolation.cdiff 1673:883f2f79c2f6 Thu Oct 29 20:30:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> Isolation: mounting of procfs by default when using "rootfs".
diff 1580:f1aefdf995d4 Thu Aug 20 14:44:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> Isolation: mount tmpfs by default.
1579:c80e692dc644 Thu Aug 20 14:22:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> Moved isolation related code to "nxt_isolation.c".
H A Dnxt_isolation.h1579:c80e692dc644 Thu Aug 20 14:22:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> Moved isolation related code to "nxt_isolation.c".
H A Dnxt_job.cdiff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
diff 20:4dc92b438f58 Thu Mar 09 15:03:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Processes refactoring.
The cycle has been renamed to the runtime.
H A Dnxt_job.hdiff 2084:7d479274f334 Sat Apr 30 17:20:00 UTC 2022 Alejandro Colomar <alx.manpages@gmail.com> Fixed #define style.

We had a mix of styles for declaring function-like macros:

Style A:
#define \
foo() \
do { \
... \
} while (0)

Style B:
#define foo() \
do { \
... \
} while (0)

We had a similar number of occurences of each style:

$ grep -rnI '^\w*(.*\\' | wc -l
244
$ grep -rn 'define.*(.*)' | wc -l
239

(Those regexes aren't perfect, but a very decent approximation.)

Real examples:

$ find src -type f | xargs sed -n '/^nxt_double_is_zero/,/^$/p'
nxt_double_is_zero(f) \
(fabs(f) <= FLT_EPSILON)

$ find src -type f | xargs sed -n '/define nxt_http_field_set/,/^$/p'
#define nxt_http_field_set(_field, _name, _value) \
do { \
(_field)->name_length = nxt_length(_name); \
(_field)->value_length = nxt_length(_value); \
(_field)->name = (u_char *) _name; \
(_field)->value = (u_char *) _value; \
} while (0)

I'd like to standardize on a single style for them, and IMO,
having the identifier in the same line as #define is a better
option for the following reasons:

- Programmers are used to `#define foo() ...` (readability).
- One less line of code.
- The program for finding them is really simple (see below).

function grep_ngx_func()
{
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <func>";
return 1;
fi;

find src -type f \
| grep '\.[ch]$' \
| xargs grep -l "$1" \
| sort \
| xargs pcregrep -Mn "(?s)^\$[\w\s*]+?^$1\(.*?^}";

find src -type f \
| grep '\.[ch]$' \
| xargs grep -l "$1" \
| sort \
| xargs pcregrep -Mn "(?s)define $1\(.*?^$" \
| sed -E '1s/^[^:]+:[0-9]+:/&\n\n/';
}

$ grep_ngx_func
Usage: grep_ngx_func <func>

$ grep_ngx_func nxt_http_field_set
src/nxt_http.h:98:

#define nxt_http_field_set(_field, _name, _value) \
do { \
(_field)->name_length = nxt_length(_name); \
(_field)->value_length = nxt_length(_value); \
(_field)->name = (u_char *) _name; \
(_field)->value = (u_char *) _value; \
} while (0)

$ grep_ngx_func nxt_sprintf
src/nxt_sprintf.c:56:

u_char * nxt_cdecl
nxt_sprintf(u_char *buf, u_char *end, const char *fmt, ...)
{
u_char *p;
va_list args;

va_start(args, fmt);
p = nxt_vsprintf(buf, end, fmt, args);
va_end(args);

return p;
}

................
Scripted change:
................

$ find src -type f \
| grep '\.[ch]$' \
| xargs sed -i '/define *\\$/{N;s/ *\\\n/ /;s/ //}'
diff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
diff 20:4dc92b438f58 Thu Mar 09 15:03:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Processes refactoring.
The cycle has been renamed to the runtime.
H A Dnxt_job_cache_file.cdiff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
H A Dnxt_js.c2247:baa6b9879267 Sun Nov 20 15:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Basic njs support.
H A Dnxt_js.h2247:baa6b9879267 Sun Nov 20 15:16:00 UTC 2022 Zhidao HONG <z.hong@f5.com> Basic njs support.
H A Dnxt_kqueue_engine.cdiff 771:f349b2d68e75 Thu Sep 20 12:05:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Added SSL/TLS support on connection level.
diff 20:4dc92b438f58 Thu Mar 09 15:03:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Processes refactoring.
The cycle has been renamed to the runtime.
H A Dnxt_lib.cdiff 20:4dc92b438f58 Thu Mar 09 15:03:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Processes refactoring.
The cycle has been renamed to the runtime.
H A Dnxt_list.cdiff 108:f87c1c4e22be Wed Jun 28 20:52:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Fixed building on Solaris broken in changeset 4077decf847b.
diff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
H A Dnxt_list.hdiff 2084:7d479274f334 Sat Apr 30 17:20:00 UTC 2022 Alejandro Colomar <alx.manpages@gmail.com> Fixed #define style.

We had a mix of styles for declaring function-like macros:

Style A:
#define \
foo() \
do { \
... \
} while (0)

Style B:
#define foo() \
do { \
... \
} while (0)

We had a similar number of occurences of each style:

$ grep -rnI '^\w*(.*\\' | wc -l
244
$ grep -rn 'define.*(.*)' | wc -l
239

(Those regexes aren't perfect, but a very decent approximation.)

Real examples:

$ find src -type f | xargs sed -n '/^nxt_double_is_zero/,/^$/p'
nxt_double_is_zero(f) \
(fabs(f) <= FLT_EPSILON)

$ find src -type f | xargs sed -n '/define nxt_http_field_set/,/^$/p'
#define nxt_http_field_set(_field, _name, _value) \
do { \
(_field)->name_length = nxt_length(_name); \
(_field)->value_length = nxt_length(_value); \
(_field)->name = (u_char *) _name; \
(_field)->value = (u_char *) _value; \
} while (0)

I'd like to standardize on a single style for them, and IMO,
having the identifier in the same line as #define is a better
option for the following reasons:

- Programmers are used to `#define foo() ...` (readability).
- One less line of code.
- The program for finding them is really simple (see below).

function grep_ngx_func()
{
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <func>";
return 1;
fi;

find src -type f \
| grep '\.[ch]$' \
| xargs grep -l "$1" \
| sort \
| xargs pcregrep -Mn "(?s)^\$[\w\s*]+?^$1\(.*?^}";

find src -type f \
| grep '\.[ch]$' \
| xargs grep -l "$1" \
| sort \
| xargs pcregrep -Mn "(?s)define $1\(.*?^$" \
| sed -E '1s/^[^:]+:[0-9]+:/&\n\n/';
}

$ grep_ngx_func
Usage: grep_ngx_func <func>

$ grep_ngx_func nxt_http_field_set
src/nxt_http.h:98:

#define nxt_http_field_set(_field, _name, _value) \
do { \
(_field)->name_length = nxt_length(_name); \
(_field)->value_length = nxt_length(_value); \
(_field)->name = (u_char *) _name; \
(_field)->value = (u_char *) _value; \
} while (0)

$ grep_ngx_func nxt_sprintf
src/nxt_sprintf.c:56:

u_char * nxt_cdecl
nxt_sprintf(u_char *buf, u_char *end, const char *fmt, ...)
{
u_char *p;
va_list args;

va_start(args, fmt);
p = nxt_vsprintf(buf, end, fmt, args);
va_end(args);

return p;
}

................
Scripted change:
................

$ find src -type f \
| grep '\.[ch]$' \
| xargs sed -i '/define *\\$/{N;s/ *\\\n/ /;s/ //}'
diff 382:0b999f4f3545 Mon Nov 20 14:08:00 UTC 2017 Max Romanov <max.romanov@nginx.com> Fixing Coverity warnings.

CID 200496
CID 200494
CID 200490
CID 200489
CID 200483
CID 200482
CID 200472
CID 200465
diff 108:f87c1c4e22be Wed Jun 28 20:52:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Fixed building on Solaris broken in changeset 4077decf847b.
diff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
diff 20:4dc92b438f58 Thu Mar 09 15:03:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Processes refactoring.
The cycle has been renamed to the runtime.
H A Dnxt_listen_socket.cdiff 771:f349b2d68e75 Thu Sep 20 12:05:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Added SSL/TLS support on connection level.
diff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
H A Dnxt_listen_socket.hdiff 771:f349b2d68e75 Thu Sep 20 12:05:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Added SSL/TLS support on connection level.
diff 65:10688b89aa16 Tue Jun 20 16:49:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Using new memory pool implementation.
H A Dnxt_log.hdiff 2084:7d479274f334 Sat Apr 30 17:20:00 UTC 2022 Alejandro Colomar <alx.manpages@gmail.com> Fixed #define style.

We had a mix of styles for declaring function-like macros:

Style A:
#define \
foo() \
do { \
... \
} while (0)

Style B:
#define foo() \
do { \
... \
} while (0)

We had a similar number of occurences of each style:

$ grep -rnI '^\w*(.*\\' | wc -l
244
$ grep -rn 'define.*(.*)' | wc -l
239

(Those regexes aren't perfect, but a very decent approximation.)

Real examples:

$ find src -type f | xargs sed -n '/^nxt_double_is_zero/,/^$/p'
nxt_double_is_zero(f) \
(fabs(f) <= FLT_EPSILON)

$ find src -type f | xargs sed -n '/define nxt_http_field_set/,/^$/p'
#define nxt_http_field_set(_field, _name, _value) \
do { \
(_field)->name_length = nxt_length(_name); \
(_field)->value_length = nxt_length(_value); \
(_field)->name = (u_char *) _name; \
(_field)->value = (u_char *) _value; \
} while (0)

I'd like to standardize on a single style for them, and IMO,
having the identifier in the same line as #define is a better
option for the following reasons:

- Programmers are used to `#define foo() ...` (readability).
- One less line of code.
- The program for finding them is really simple (see below).

function grep_ngx_func()
{
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <func>";
return 1;
fi;

find src -type f \
| grep '\.[ch]$' \
| xargs grep -l "$1" \
| sort \
| xargs pcregrep -Mn "(?s)^\$[\w\s*]+?^$1\(.*?^}";

find src -type f \
| grep '\.[ch]$' \
| xargs grep -l "$1" \
| sort \
| xargs pcregrep -Mn "(?s)define $1\(.*?^$" \
| sed -E '1s/^[^:]+:[0-9]+:/&\n\n/';
}

$ grep_ngx_func
Usage: grep_ngx_func <func>

$ grep_ngx_func nxt_http_field_set
src/nxt_http.h:98:

#define nxt_http_field_set(_field, _name, _value) \
do { \
(_field)->name_length = nxt_length(_name); \
(_field)->value_length = nxt_length(_value); \
(_field)->name = (u_char *) _name; \
(_field)->value = (u_char *) _value; \
} while (0)

$ grep_ngx_func nxt_sprintf
src/nxt_sprintf.c:56:

u_char * nxt_cdecl
nxt_sprintf(u_char *buf, u_char *end, const char *fmt, ...)
{
u_char *p;
va_list args;

va_start(args, fmt);
p = nxt_vsprintf(buf, end, fmt, args);
va_end(args);

return p;
}

................
Scripted change:
................

$ find src -type f \
| grep '\.[ch]$' \
| xargs sed -i '/define *\\$/{N;s/ *\\\n/ /;s/ //}'

12345678910>>...15