/unit/src/ |
H A D | nxt_fd_event.h | diff 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/ //}'
|
H A D | nxt_fiber.c | diff 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 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_fiber.h | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_file.h | diff 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/ //}'
|
H A D | nxt_freebsd_sendfile.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_http.h | diff 1991:61155eb41a96 Fri Nov 05 14:56:00 UTC 2021 Zhidao HONG <z.hong@f5.com> Router: matching query string support.
The "query" option matches decoded arguments, including plus ('+') to space (' '). Like "uri", it can be a string or an array of strings.
|
H A D | nxt_http_chunk_parse.c | diff 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 704:1fcac04f0a15 Mon Jun 25 13:56:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Removed '\r' and '\n' artifact macros. diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_http_parse.c | diff 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 1126:50a8b6ded8e2 Thu Aug 15 21:56:00 UTC 2019 Max Romanov <max.romanov@nginx.com> Improving response header fields processing.
Fields are filtered one by one before being added to fields list. This avoids adding and then skipping connection-specific fields. diff 704:1fcac04f0a15 Mon Jun 25 13:56:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Removed '\r' and '\n' artifact macros.
|
H A D | nxt_http_parse.h | diff 1126:50a8b6ded8e2 Thu Aug 15 21:56:00 UTC 2019 Max Romanov <max.romanov@nginx.com> Improving response header fields processing.
Fields are filtered one by one before being added to fields list. This avoids adding and then skipping connection-specific fields. diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_http_route.c | diff 1991:61155eb41a96 Fri Nov 05 14:56:00 UTC 2021 Zhidao HONG <z.hong@f5.com> Router: matching query string support.
The "query" option matches decoded arguments, including plus ('+') to space (' '). Like "uri", it can be a string or an array of strings.
|
H A D | nxt_isolation.c | diff 2354:c6a613bd7bd0 Wed Feb 22 16:04:00 UTC 2023 Andrew Clayton <a.clayton@nginx.com> Isolation: rootfs: Set the sticky bit on the tmp directory.
When using the 'rootfs' isolation option, by default a tmpfs filesystem is mounted on tmp/. Currently this is mounted with a mode of 0777, i.e
drwxrwxrwx. 3 root root 60 Feb 22 11:56 tmp
however this should really have the sticky bit[0] set (as is per-normal for such directories) to prevent users from having free reign on the files contained within.
What we really want is it mounted with a mode of 01777, i.e
drwxrwxrwt. 3 root root 60 Feb 22 11:57 tmp
[0]: To quote inode(7)
"The sticky bit (S_ISVTX) on a directory means that a file in that directory can be renamed or deleted only by the owner of the file, by the owner of the directory, and by a privileged process."
Reviewed-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com> diff 2331:48798e038044 Wed Feb 22 16:04:00 UTC 2023 Andrew Clayton <a.clayton@nginx.com> Isolation: rootfs: Set the sticky bit on the tmp directory.
When using the 'rootfs' isolation option, by default a tmpfs filesystem is mounted on tmp/. Currently this is mounted with a mode of 0777, i.e
drwxrwxrwx. 3 root root 60 Feb 22 11:56 tmp
however this should really have the sticky bit[0] set (as is per-normal for such directories) to prevent users from having free reign on the files contained within.
What we really want is it mounted with a mode of 01777, i.e
drwxrwxrwt. 3 root root 60 Feb 22 11:57 tmp
[0]: To quote inode(7)
"The sticky bit (S_ISVTX) on a directory means that a file in that directory can be renamed or deleted only by the owner of the file, by the owner of the directory, and by a privileged process."
Reviewed-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com> diff 1708:4463c1fc26fd Mon Nov 16 17:56:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> Isolation: added option to disable "procfs" mount.
Now users can disable the default procfs mount point in the rootfs.
{ "isolation": { "automount": { "procfs": false } } }
|
H A D | nxt_job.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_job.h | diff 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 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_kqueue_engine.c | diff 56:92b4984ca3c1 Tue Jun 06 15:57:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> C99 style declaration of connection states.
|
H A D | nxt_lib.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_linux_sendfile.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_list.h | diff 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/ //}'
|
H A D | nxt_log.c | diff 704:1fcac04f0a15 Mon Jun 25 13:56:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Removed '\r' and '\n' artifact macros. diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_log.h | diff 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 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_log_moderation.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_log_moderation.h | diff 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/ //}'
|
H A D | nxt_lvlhsh.c | diff 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/ //}'
|
H A D | nxt_lvlhsh.h | diff 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/ //}'
|
H A D | nxt_macosx_sendfile.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|
H A D | nxt_main.c | diff 1:fdc027c56872 Mon Jan 23 16:56:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Introducing tasks.
|