History log of /unit/src/nxt_string.h (Results 1 – 22 of 22)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2232:1fb2182a4d03 02-Nov-2022 Alejandro Colomar

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'

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>

show more ...


# 2231:5b3a69fd47a7 02-Nov-2022 Alejandro Colomar

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
ex

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>

show more ...


Revision tags: 1.28.0-1, 1.28.0
# 2139:99d792169ffb 16-Jun-2022 Andrew Clayton

Constified numerous function parameters.

As was pointed out by the cppcheck[0] static code analysis utility we
can mark numerous function parameters as 'const'. This acts as a hint to
the compiler a

Constified numerous function parameters.

As was pointed out by the cppcheck[0] static code analysis utility we
can mark numerous function parameters as 'const'. This acts as a hint to
the compiler about our intentions and the compiler will tell us when we
deviate from them.

[0]: https://cppcheck.sourceforge.io/

show more ...


Revision tags: 1.27.0-1, 1.27.0
# 2084:7d479274f334 30-Apr-2022 Alejandro Colomar

Fixed #define style.

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

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

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/ //}'

show more ...


Revision tags: 1.26.1-1, 1.26.1, 1.26.0-1, 1.26.0
# 1975:6a47cab8f271 26-Oct-2021 Valentin Bartenev

Custom implementation of Base64 decoding function.

Compared to the previous implementation based on OpenSSL, the new implementation
has these advantages:

1. Strict and reliable detection of invali

Custom implementation of Base64 decoding function.

Compared to the previous implementation based on OpenSSL, the new implementation
has these advantages:

1. Strict and reliable detection of invalid strings, including strings with
less than 4 bytes of garbage at the end;

2. Allows to use Base64 strings without '=' padding.

show more ...


Revision tags: 1.25.0-1, 1.25.0, 1.24.0-1, 1.24.0, 1.23.0-1, 1.23.0, 1.22.0-1, 1.22.0, 1.21.0-1, 1.21.0, 1.20.0-1, 1.20.0
# 1580:f1aefdf995d4 20-Aug-2020 Tiago Natel de Moura

Isolation: mount tmpfs by default.


Revision tags: 1.19.0-1, 1.19.0, 1.18.0-1, 1.18.0
# 1481:235553af9977 15-May-2020 Valentin Bartenev

Fixed global constant declaration (appeared in 9af10e099d09).

This fixes building with GCC 10, which is default to -fno-common.
See: https://gcc.gnu.org/gcc-10/porting_to.html


# 1474:9af10e099d09 13-May-2020 Axel Duch

Router: decode uri and args.


Revision tags: 1.17.0-1, 1.17.0
# 1439:32578e837322 30-Mar-2020 Valentin Bartenev

Configuration: support for rational numbers.


# 1431:fe30a27f21ba 27-Mar-2020 Valentin Bartenev

Added nxt_is_complex_uri_encoded()/nxt_encode_complex_uri().


Revision tags: 1.16.0-1, 1.16.0, 1.15.0-1, 1.15.0, 1.14.0-1, 1.14.0, 1.13.0-1, 1.13.0
# 1234:e56683f325ab 10-Oct-2019 Igor Sysoev

Changed nxt_memcasecmp() interface to avoid casts.


Revision tags: 1.12.0-1, 1.12.0, 1.11.0-2, 1.11.0-1, 1.11.0
# 1183:6008abf06746 18-Sep-2019 Valentin Bartenev

Basic support for serving static files.


# 1167:a49ee872e83d 16-Sep-2019 Valentin Bartenev

Configuration: added ability to access object members with slashes.

Now URI encoding can be used to escape "/" in the request path:

GET /config/listeners/unix:%2Fpath%2Fto%2Fsocket/


Revision tags: 1.10.0-2, 1.10.0-1, 1.10.0, 1.9.0-1, 1.9.0, 1.8.0-1, 1.8.0
# 963:d847762b684b 26-Feb-2019 Igor Sysoev

Introduced nxt_memcpy_upcase().


Revision tags: 1.7.1-1, 1.7.1, 1.7-1, 1.7, 1.6-1, 1.6, 1.5-1, 1.5, 1.4-2, 1.4, 1.3
# 704:1fcac04f0a15 25-Jun-2018 Igor Sysoev

Removed '\r' and '\n' artifact macros.


# 703:2d536dde84d2 25-Jun-2018 Valentin Bartenev

Introduced nxt_length() macro.


Revision tags: 1.2, 1.1, 1.0, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2
# 354:8fc82db3530b 05-Oct-2017 Valentin Bartenev

Improved applications versions handling.


Revision tags: 0.1
# 216:07257705cd64 17-Aug-2017 Igor Sysoev

The new module configuration interface.

Configuration and building example:

./configure
./configure python
./configure php
./configure go
make all

or

./configure
make nginext
./co

The new module configuration interface.

Configuration and building example:

./configure
./configure python
./configure php
./configure go
make all

or

./configure
make nginext
./configure python
make python
./configure php
make php
./configure go
make go

Modules configuration options and building examples:

./configure python --module=python2 --config=python2.7-config
make python2

./configure php --module=php7 --config=php7.0-config
--lib-path=/usr/local/php7.0
make php7

./configure go --go=go1.6 --go-path=${HOME}/go1.6
make go1.6

show more ...


# 212:d532db63e8cb 16-Aug-2017 Valentin Bartenev

Renamed nxt_str_copy() to nxt_str_cstrz().


# 65:10688b89aa16 20-Jun-2017 Igor Sysoev

Using new memory pool implementation.


# 10:a8e68ed06863 01-Feb-2017 Igor Sysoev

nxt_str_t changes.


# 0:a63ceefd6ab0 17-Jan-2017 Igor Sysoev

Initial version.