Kim Alvefur
20fc0c9c15
Back out changeset 2c1583bb0e0f
...
Same reason as 712b2e6a09d9
5 years ago
Kim Alvefur
bad47be8f9
Back out 6dde2c9fa272: Doesn't work on Lua 5.1
5 years ago
Kim Alvefur
9b8a54345f
util.strbitop: Remove redundant init function
...
When you have 3 almost identical functions, you tend to edit one and
then copypaste. Forgot to remove this line from the other two.
5 years ago
Kim Alvefur
da8eca639a
util.strbitop: Create buffer in the correct size (optimization)
...
This avoids dynamically growing the buffer as Lua does when luaL_addchar
is used, thus saving on realloc calls.
5 years ago
Kim Alvefur
539255c692
util.strbitop: Reformat code
...
astyle \
--indent=tab \
--attach-classes \
--indent-switches \
--break-blocks \
--pad-oper \
--unpad-paren \
--add-braces \
--align-pointer=name \
--lineend=linux \
*.c
5 years ago
Kim Alvefur
9eb8214030
configure: Pass compiler flag to enable ICU only when building util.encodings
...
Passing it in CFLAGS applied to all modules, which was not needed.
6 years ago
Kim Alvefur
fb1808b185
util.strbitop: Library for bitwise operations on strings
6 years ago
Matthew Wild
b9a670dace
util.ringbuffer: Ensure unsigned chars are always returned from :byte()
6 years ago
Kim Alvefur
625ec0a93f
util-src: Use the luaL_pushfail API added in Lua 5.4 to highlight all failure conditions
...
Actually just an alias of pushnil, but it does make it more obvious
where the failure conditions are, which is good for readability.
6 years ago
Matthew Wild
14a436817d
util.ringbuffer: Add :sub() and :byte() methods equivalent to the string methods
6 years ago
Kim Alvefur
4bab7af07d
util.ringbuffer: Prevent creation of buffer with negative size
...
Previously this would have been (unsigned)-1 which is a large positive
integer.
6 years ago
Kim Alvefur
0bb1474ce6
util.ringbuffer: Prevent creation of zero-size buffer
6 years ago
Kim Alvefur
8055c8f7d7
util.pposix,signal: Pass around various OS numbers as integers [Lua 5.3]
...
Passing around PIDs, UIDs etc as integers makes it more sane in Lua 5.3.
Getting 1234.0 as PID is silly. Shouldn't change any behavior as these
are all integers on the C side and the integral floats are accepted as
integers when passed back from Lua into C.
6 years ago
Kim Alvefur
701c5f4811
util.hashes: Fix output length of PBKDF2-HMAC-SHA256
...
Somehow it got SHA1's 20 byte output instead of the proper 32 = 256/8
6 years ago
Emmanuel Gil Peyrot
668dc534b6
util.net: Fix signedness warning on ARM
...
net.c:87:56: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘long int’ [-Wsign-compare]
6 years ago
Emmanuel Gil Peyrot
a149dda0e3
util.*.c: Add static qualifiers everywhere
6 years ago
Emmanuel Gil Peyrot
8613dc1739
util.encodings: Remove redundant cast
6 years ago
Emmanuel Gil Peyrot
d209c0c677
util.encodings: Don’t export unneeded symbols
...
This reduces the binary size from 22704 B to 18592 B.
6 years ago
Kim Alvefur
c4c38d2f01
util.pposix: Avoid overflow of malloc info at 2GB ( fixes #1445 until 4GB)
6 years ago
Kim Alvefur
b679ffe808
util.encodings: Don't ignore non-strings passed to stringprep functions
...
If you manage to pass a table or something weird to these, you deserve
to know.
6 years ago
Kim Alvefur
42aeda373c
util.encodings: Strictly verify that the 'strict' *prep argument is a boolean
...
This is to prevent mistakes like nodeprep(username:gsub("a","b")) from
unintentionally invoking strict mode.
6 years ago
Kim Alvefur
c42a786ec7
util.encodings: Allow unassigned code points in ICU mode to match libidn behavior ( fixes #1348 )
7 years ago
Kim Alvefur
41a40ab74b
util.encodings: Optional strict flag to stringprep
7 years ago
Kim Alvefur
bf1a0c2f05
util.encodings: Spell out all IDNA 2008 options ICU has
6 years ago
Kim Alvefur
bb4cb60fb8
util.encodings: Switch ICU binding to IDNA2008 ( fixes #533 , #1301 )
6 years ago
Kim Alvefur
7ef028d8d4
util.hashes: Use HMAC function provided by OpenSSL ( fixes #1345 )
7 years ago
Kim Alvefur
63c03ce6ef
util.encodings: Declare absence of arguments [-Wstrict-prototypes]
7 years ago
Kim Alvefur
d21439da5c
util-src/makefile: Update with util.poll and util.compat ( fixes #1251 )
7 years ago
Matthew Wild
1454ac8208
util.xpcall, util.compat: Add non-hacky multi-argument xpcall() for Lua 5.1
7 years ago
Kim Alvefur
2bb3772374
net.server_epoll: Special handling of signal interrupts
7 years ago
Kim Alvefur
afeb1f6f02
net.server_epoll: Ignore ENOENT when deregitering socket
...
It should not really happen
7 years ago
Kim Alvefur
bbf669b2c5
net.server_epoll: Graceful handling of registering already added socket
7 years ago
Kim Alvefur
f26390b484
util.poll: Fix inverted logic
7 years ago
Kim Alvefur
9547e0e66d
util.poll: Handle failed epoll FD creation
7 years ago
Kim Alvefur
22e0c16d4c
util.poll: Early return from __gc in case of no valid epoll FD
...
This could happen if the epoll FD has already been closed or
the epoll_create call failed
7 years ago
Kim Alvefur
28522988cc
util.poll: Increase max epoll events per call
...
This makes the struct roughly the same size in both epoll and select
mode (64bit).
There doesn’t seem to be much guidance on an appropriate size, it does
not seem to matter too much since if there are more events they will
simply show up in the next epoll_wait call. The number of exactly
concurrent events should be fairly low most of the time anyways.
7 years ago
Kim Alvefur
4a73f5daef
util.poll: Zero FD sets watched for errors on creation
7 years ago
Kim Alvefur
ceadb9c57c
net.poll: Guard against negative or too large FDs
7 years ago
Kim Alvefur
31c8b1aca3
util.poll: Fix missing return for adding duplicate FD
7 years ago
Kim Alvefur
8126707125
util.poll: Tweak metatable name field
7 years ago
Kim Alvefur
d3c236c693
util.poll: Fix monitoring of socket exceptions in select mode
...
Since state->err is a set of all watched FDs, this mistake caused all
sockets to appear to have errors.
7 years ago
Kim Alvefur
110ce660d5
util.poll: Lua 5.1 compat
7 years ago
Kim Alvefur
1ad376770f
util.poll: Remove 'inline' from function declaration
...
Why does this fix building?
7 years ago
Kim Alvefur
530a9f9c8e
util.pposix: Fix or silence a warning on OS X ( #1202 )
7 years ago
Kim Alvefur
b78f1d3da1
util.pposix: Fix building on OS X ( #1202 )
7 years ago
Kim Alvefur
fa4507823f
util.poll: Import poll library with epoll and select support
8 years ago
Kim Alvefur
2f939029ef
util.pposix: Allow _DARWIN_C_SOURCE to be overriden
...
Like the others there
7 years ago
Kim Alvefur
6391242937
util.pposix: Restrict use of malloc_info to glibc
...
Fixes build on musl based distros like Alpine linux
7 years ago
Kim Alvefur
53c20a796e
util.pposix: Do not attempt to assign to stdio variables [pedantic]
...
Fixes build on gcc 6.4.0
See also https://stackoverflow.com/a/586416
7 years ago
Kim Alvefur
49232398ed
util-src/makefile: Add util.time to BSD makefile
7 years ago