Commit Graph

8 Commits

Author SHA1 Message Date
Ben Noordhuis
442b8a5a84 unix: use QUEUE_MOVE when iterating over lists
Replace uses of QUEUE_FOREACH when the list can get modified while
iterating over it, in particular when a callback is made into the
user's code.  This should fix a number of spurious failures that
people have been reporting.

PR-URL: https://github.com/libuv/libuv/pull/565
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-10-08 21:47:43 +02:00
Ben Noordhuis
1867a6c1ce src: replace QUEUE_SPLIT with QUEUE_MOVE
All uses of QUEUE_SPLIT in libuv split the list at the head so introduce
a QUEUE_MOVE macro that automates that.

PR-URL: https://github.com/libuv/libuv/pull/565
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-10-08 21:46:48 +02:00
Saúl Ibarra Corretgé
e791e4532e common: use offsetof for QUEUE_DATA
Silences the following runtime errors when compiling UBSan:

../src/unix/linux-core.c:181:9: runtime error: member access within null
pointer of type 'uv__io_t' (aka 'struct uv__io_s')
../src/unix/process.c:67:15: runtime error: member access within null
pointer of type 'uv_process_t' (aka 'struct uv_process_s')
../src/unix/process.c:91:15: runtime error: member access within null
pointer of type 'uv_process_t' (aka 'struct uv_process_s')
...

PR-URL: https://github.com/libuv/libuv/pull/422
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-07-03 11:38:24 +02:00
Ben Noordhuis
0520464870 queue: strengthen type checks
Rewrite some of the macros in a way that:

  a) makes them more likely to trigger compile-time errors if used
     inappropriately, and

  b) makes C++ compilers happy
2013-11-02 13:55:57 +01:00
Ben Noordhuis
8531046a86 windows: omit stdint.h, fix msvc 2008 build error
Don't include <stdint.h>, it's not available when compiling with MSVC
2008 and we don't need it in the first place - just cast the argument
to `char *` rather than `uintptr_t`.

Fixes #893.
2013-08-20 14:06:35 +02:00
Bert Belder
7d8504cf69 queue: fix pointer truncation on LLP64 platforms
QUEUE_DATA used to cast a pointer to long and back to pointer. This can
corrupt pointers on systems where the long type isn't large enough to
store pointer, like Windows x64. This commit fixes that.

Fixes #835
2013-06-15 14:08:36 +02:00
Ben Noordhuis
c766dfe815 src: make queue.h c++ compatible
Squelch a warning about a cast from void* to another pointer type.
It's legal C but not legal C++. Makes queue.h usable in node.js.
2013-06-04 12:20:40 +02:00
Ben Noordhuis
0635e29714 unix, windows: remove ngx-queue.h
Avoids an extra #include in public headers and stops the ngx_queue_*
types and macros from leaking into user code.
2013-03-27 00:09:36 +01:00