History log of /libuv/src/uv-common.c (Results 26 – 50 of 141)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 8972e65b 03-Dec-2018 Ben Noordhuis

unix: harden string copying, introduce strscpy()

Replace calls to strcpy() and strncpy() with the newly introduced
uv__strscpy() function that is meticulous about zero-terminating
th

unix: harden string copying, introduce strscpy()

Replace calls to strcpy() and strncpy() with the newly introduced
uv__strscpy() function that is meticulous about zero-terminating
the destination buffer.

PR-URL: https://github.com/libuv/libuv/pull/2065
Refs: https://www.kernel.org/doc/htmldocs/kernel-api/API-strscpy.html
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>

show more ...

# ba780231 16-Oct-2018 Ben Noordhuis

unix,win: handle zero-sized allocations uniformly

`malloc(0)` and `realloc(p, 0)` can either return NULL or a unique
pointer. Make our custom allocator return NULL for consistency across

unix,win: handle zero-sized allocations uniformly

`malloc(0)` and `realloc(p, 0)` can either return NULL or a unique
pointer. Make our custom allocator return NULL for consistency across
platforms and libcs.

PR-URL: https://github.com/libuv/libuv/pull/2038
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

# 5124b27d 20-Jun-2018 Shelley Vohr

src: add new error apis to prevent memory leaks

This PR creates two new externally-facing APIs, uv_err_name_r() and
uv_strerror_r().

In keeping with the precedent set by POSIX,

src: add new error apis to prevent memory leaks

This PR creates two new externally-facing APIs, uv_err_name_r() and
uv_strerror_r().

In keeping with the precedent set by POSIX, the *_r() suffix of these
two new methods indicate that the caller does the memory management and
passes in the memory that the output will be stored in, which provides
an alternative for the two existent methods (uv_err_name() and
uv_strerror()), which, when called with an unknown error code, leak a
few bytes of memory.

PR-URL: https://github.com/libuv/libuv/pull/1898
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno santiago.gimeno@gmail.com

show more ...

# 619937c7 28-Jun-2018 Ben Noordhuis

unix,win: merge handle flags

Some long overdue refactoring that unifies more of the UNIX and Windows
backends.

PR-URL: https://github.com/libuv/libuv/pull/1904
Reviewed-By:

unix,win: merge handle flags

Some long overdue refactoring that unifies more of the UNIX and Windows
backends.

PR-URL: https://github.com/libuv/libuv/pull/1904
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 88c2af0e 14-Nov-2017 Jameson Nash

req: revisions to uv_req_t handling

- Remove the `active_reqs` queue, which is never used. There are more
efficient per-stream queues that `libuv` uses whenever it needs this

req: revisions to uv_req_t handling

- Remove the `active_reqs` queue, which is never used. There are more
efficient per-stream queues that `libuv` uses whenever it needs this
information, so duplicating it and managing it here seems
like unnecessary extra space and work.
- Unix `uv_loop_init` didn't explicitly initialize.
`loop->active_handles` (although it did memset the whole struct
to 0, so it wasn't wrong previously, just inconsistent).
- Consolidate repeated code for `uv__has_active_reqs`.
- Change `uv__loop_alive` to use the helper functions (mirroring the
unix copy of the same function).
- Initialize some more uv_stream_t fields in init, rather than waiting
for the connection callback. This helps surface bugs in libuv or the
caller better, since it ensures libuv doesn't see uninitialized
memory if asked to look at these fields before it thinks the socket
is connected.
- Fixes what appears to be a double-counting of `handle->reqs_pending`,
in the highly-unlikely event that the code wants to emulate IOCP,
but `RegisterWaitForSingleObject` somehow managed to fail.

PR-URL: https://github.com/libuv/libuv/pull/1746
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

# c8ab24bb 05-Jan-2017 muflub

fs: fix crash in uv_fs_scandir_next

Handle the case when it's called after the request has ended, or in case
it ended with an error.

PR-URL: https://github.com/libuv/libuv/pull/

fs: fix crash in uv_fs_scandir_next

Handle the case when it's called after the request has ended, or in case
it ended with an error.

PR-URL: https://github.com/libuv/libuv/pull/1181
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 0d586b7d 29-Sep-2016 Brad King

common: fix unused variable warning

The saved_data variable in uv_loop_close() is only used when
NDEBUG is defined. This commit makes the variable declaration
depend on NDEBUG as wel

common: fix unused variable warning

The saved_data variable in uv_loop_close() is only used when
NDEBUG is defined. This commit makes the variable declaration
depend on NDEBUG as well.

PR-URL: https://github.com/libuv/libuv/pull/1093
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# ff0ae104 20-Jul-2016 Ben Noordhuis

unix: preserve loop->data across loop init/done

Libuv leaves loop->data unchanged in uv_loop_init() and uv_loop_done()
on Windows but it clobbered it on UNIX platforms. This commit fixe

unix: preserve loop->data across loop init/done

Libuv leaves loop->data unchanged in uv_loop_init() and uv_loop_done()
on Windows but it clobbered it on UNIX platforms. This commit fixes
that inconsistency.

PR-URL: https://github.com/libuv/libuv/pull/951
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 40e7a986 16-May-2016 cjihrig

common: release uv_fs_scandir() array

uv__fs_scandir_cleanup() releases individual directory entries,
but not the container array. This commit frees the array as well.

Fixes: ht

common: release uv_fs_scandir() array

uv__fs_scandir_cleanup() releases individual directory entries,
but not the container array. This commit frees the array as well.

Fixes: https://github.com/libuv/libuv/issues/873
PR-URL: https://github.com/libuv/libuv/pull/874
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 4fa89fbc 16-May-2016 cjihrig

unix: use system allocator for scandir()

On unix, scandir() uses the system allocator to allocate memory.
This commit releases the memory with free() instead of uv__free().
uv__free(

unix: use system allocator for scandir()

On unix, scandir() uses the system allocator to allocate memory.
This commit releases the memory with free() instead of uv__free().
uv__free() is still used on Windows, which uses uv__malloc() to
request the memory.

Fixes: https://github.com/libuv/libuv/issues/873
PR-URL: https://github.com/libuv/libuv/pull/874
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 322de63a 18-Apr-2016 Ben Noordhuis

unix: guard against clobbering errno in uv__free()

Libuv expects that free() does not clobber errno. The system allocator
honors that assumption but custom allocators may not be so care

unix: guard against clobbering errno in uv__free()

Libuv expects that free() does not clobber errno. The system allocator
honors that assumption but custom allocators may not be so careful.

PR-URL: https://github.com/libuv/libuv/pull/837
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

# 2606ba22 21-Jan-2016 Saúl Ibarra Corretgé

unix, win: count null byte on UV_ENOBUFS

If an API function returns UV_ENOBUFS make sure we count the terminating
null, which we need space for. In case of success the null byte is not

unix, win: count null byte on UV_ENOBUFS

If an API function returns UV_ENOBUFS make sure we count the terminating
null, which we need space for. In case of success the null byte is not
included in the count, but the buffer *is* null terminated.

PR-URL: https://github.com/libuv/libuv/pull/690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

# e5f4b798 20-Jan-2016 Saúl Ibarra Corretgé

unix, win: consistently null-terminate buffers

libuv has multiple functions which return buffers. Make them consistent
with the following rules: the returned size *does not* include the

unix, win: consistently null-terminate buffers

libuv has multiple functions which return buffers. Make them consistent
with the following rules: the returned size *does not* include the null
byte, but the buffer *is* null terminated.

There is only one exception to the above: Linux abstract sockets,
because null bytes are not used as string terminators in those.

Refs: https://github.com/libuv/libuv/pull/674
PR-URL: https://github.com/libuv/libuv/pull/690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

# 6490c508 16-Nov-2015 Petka Antonov

misc: expose handle print APIs

PR-URL: https://github.com/libuv/libuv/pull/291
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

# 442b8a5a 08-Oct-2015 Ben Noordhuis

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
us

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>

show more ...

# a59085e1 19-Sep-2015 Peter Jas

win: use the MSVC provided snprintf where possible

PR-URL: https://github.com/libuv/libuv/pull/532
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

# 4c81d051 19-Aug-2015 Saúl Ibarra Corretgé

common: fix use of snprintf on Windows

Refs: https://github.com/libuv/libuv/pull/467
PR-URL: https://github.com/libuv/libuv/pull/487
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

# 96fc77d5 30-Jul-2015 Ben Noordhuis

unix,windows: don't assert on unknown error code

Make uv_err_name() and uv_strerror() return a dynamically allocated
string when the error code is not recognized.

It leaks a few

unix,windows: don't assert on unknown error code

Make uv_err_name() and uv_strerror() return a dynamically allocated
string when the error code is not recognized.

It leaks a few bytes of memory but that can't be helped. Asserting
and aborting is, in my opinion, much less helpful.

Fixes: https://github.com/nodejs/node/issues/63
PR-URL: https://github.com/libuv/libuv/pull/467
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# c0c26a0f 10-Jun-2015 Cheng Zhao

win: include "malloc.h"

As stated in malloc's docs[1], the malloc.h is required for using the
malloc function, and from malloc.h's source code (which can be found
under installed VS)

win: include "malloc.h"

As stated in malloc's docs[1], the malloc.h is required for using the
malloc function, and from malloc.h's source code (which can be found
under installed VS), malloc is defined as a macro that has different
behaviors under different configurations.

So using malloc without including malloc.h is very dangerous, for
certain build configurations crashes can happen when writing to memory
allocated by malloc.

[1]: https://msdn.microsoft.com/en-us/library/6ewkz86d.aspx

PR-URL: https://github.com/libuv/libuv/pull/395
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# bddd6a84 26-May-2015 Saúl Ibarra Corretgé

core: add ability to customize memory allocator

This patch is composed by the work done in
https://github.com/libuv/libuv/pull/231 and
https://github.com/libuv/libuv/pull/287 plus so

core: add ability to customize memory allocator

This patch is composed by the work done in
https://github.com/libuv/libuv/pull/231 and
https://github.com/libuv/libuv/pull/287 plus some changes by yours
truly.

Thanks @beevik and @mattsta for their work on this!

PR-URL: https://github.com/libuv/libuv/pull/368
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

# 710fcf7d 05-May-2015 Saúl Ibarra Corretgé

unix: squelch compiler warning on release builds

Fixes: https://github.com/libuv/libuv/issues/343

# 1f711e4d 29-Apr-2015 Saúl Ibarra Corretgé

Revert "memory: add uv_replace_allocator"

This reverts commit c272f1f1bc0bda625e6441d798c110b4064a6ce2.

The concept will come back to libuv, but it needs some more work.

# c272f1f1 26-Feb-2015 Brett Vickers

memory: add uv_replace_allocator

With uv_replace_allocator, it's possible to override the default
memory allocator's malloc and free calls with functions of the user's
choosing. This

memory: add uv_replace_allocator

With uv_replace_allocator, it's possible to override the default
memory allocator's malloc and free calls with functions of the user's
choosing. This allows libuv to interoperate with projects requiring a
custom memory allocator.

Internally, all calls to malloc and free have been replaced with
uv__malloc and uv__free, respectively. The uv__malloc and uv__free
functions call malloc and free unless they have been overridden by a
previous call to uv_replace_allocator.

As part of this change, the special aligned memory allocations
performed in src/win/fs-event.c have been replaced with standard
allocations. The 4-byte alignment being requested in this file was
unnecessary, since standard allocators already guarantee at least an
8-byte alignment.

PR-URL: https://github.com/libuv/libuv/pull/231
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 073323ba 03-Mar-2015 TomCrypto

win: name all anonymous structs and unions

All the public structs and unions in the private fields in uv-win.h have
been named and all code accessing them updated, to comply to the C89

win: name all anonymous structs and unions

All the public structs and unions in the private fields in uv-win.h have
been named and all code accessing them updated, to comply to the C89
spec (which were previously causing warnings with the -pedantic flag).

PR-URL: https://github.com/libuv/libuv/pull/239
Reviewed-By: Andrius Bentkus <andrius.bentkus@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

Revision tags: v1.3.0, v0.10.33
# 2bfa2e5e 23-Jan-2015 Andrius Bentkus

style: rename buf to buffer and len to size for consistency

PR-URL: https://github.com/libuv/libuv/pull/159
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

123456