diff options
| author | Alejandro Colomar <alx@nginx.com> | 2023-08-24 01:12:27 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx@nginx.com> | 2023-09-04 03:40:33 +0200 |
| commit | 3dfab08abc813c9cd2b5e9cb910ae5c557117c93 (patch) | |
| tree | 62e72159e20df08f833a72c31bdee0ab021adace /src/nxt_string.h | |
| parent | 39db8691fe40adcfdb827c194636b87391c7c416 (diff) | |
| download | unit-3dfab08abc813c9cd2b5e9cb910ae5c557117c93.tar.gz unit-3dfab08abc813c9cd2b5e9cb910ae5c557117c93.tar.bz2 | |
String: added strto[u]l(3) variants for nxt_str_t.
They're really more inspired in the API of BSD's strto[iu](3), but use
long just to keep it simple, instead of intmax_t, and since they wrap
strtol(3), I called them like it.
Signed-off-by: Alejandro Colomar <alx@nginx.com>
Diffstat (limited to '')
| -rw-r--r-- | src/nxt_string.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nxt_string.h b/src/nxt_string.h index 18ea5490..72e545ce 100644 --- a/src/nxt_string.h +++ b/src/nxt_string.h @@ -161,7 +161,18 @@ NXT_EXPORT nxt_bool_t nxt_is_complex_uri_encoded(u_char *s, size_t length); NXT_EXPORT ssize_t nxt_base64_decode(u_char *dst, u_char *src, size_t length); +NXT_EXPORT long nxt_ustrtol(const nxt_str_t *s, int *err); +nxt_inline unsigned long nxt_ustrtoul(const nxt_str_t *s, int *err); + + extern const uint8_t nxt_hex2int[256]; +nxt_inline unsigned long +nxt_ustrtoul(const nxt_str_t *s, int *err) +{ + return nxt_ustrtol(s, err); +} + + #endif /* _NXT_STRING_H_INCLUDED_ */ |
