summaryrefslogtreecommitdiff
path: root/deps/uv/src/win/fs-event.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/win/fs-event.c')
-rw-r--r--deps/uv/src/win/fs-event.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/deps/uv/src/win/fs-event.c b/deps/uv/src/win/fs-event.c
index 640651b6c9..eb205d3921 100644
--- a/deps/uv/src/win/fs-event.c
+++ b/deps/uv/src/win/fs-event.c
@@ -72,13 +72,13 @@ static int uv_split_path(const WCHAR* filename, WCHAR** dir,
if (i == 0) {
if (dir) {
- *dir = (WCHAR*)malloc((MAX_PATH + 1) * sizeof(WCHAR));
+ *dir = (WCHAR*)uv__malloc((MAX_PATH + 1) * sizeof(WCHAR));
if (!*dir) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
if (!GetCurrentDirectoryW(MAX_PATH, *dir)) {
- free(*dir);
+ uv__free(*dir);
*dir = NULL;
return -1;
}
@@ -87,17 +87,17 @@ static int uv_split_path(const WCHAR* filename, WCHAR** dir,
*file = wcsdup(filename);
} else {
if (dir) {
- *dir = (WCHAR*)malloc((i + 1) * sizeof(WCHAR));
+ *dir = (WCHAR*)uv__malloc((i + 1) * sizeof(WCHAR));
if (!*dir) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
wcsncpy(*dir, filename, i);
(*dir)[i] = L'\0';
}
- *file = (WCHAR*)malloc((len - i) * sizeof(WCHAR));
+ *file = (WCHAR*)uv__malloc((len - i) * sizeof(WCHAR));
if (!*file) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
wcsncpy(*file, filename + i + 1, len - i - 1);
(*file)[len - i - 1] = L'\0';
@@ -137,18 +137,18 @@ int uv_fs_event_start(uv_fs_event_t* handle,
return UV_EINVAL;
handle->cb = cb;
- handle->path = strdup(path);
+ handle->path = uv__strdup(path);
if (!handle->path) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
uv__handle_start(handle);
/* Convert name to UTF16. */
name_size = uv_utf8_to_utf16(path, NULL, 0) * sizeof(WCHAR);
- pathw = (WCHAR*)malloc(name_size);
+ pathw = (WCHAR*)uv__malloc(name_size);
if (!pathw) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
if (!uv_utf8_to_utf16(path, pathw,
@@ -192,7 +192,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
}
dir_to_watch = dir;
- free(pathw);
+ uv__free(pathw);
pathw = NULL;
}
@@ -207,7 +207,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
NULL);
if (dir) {
- free(dir);
+ uv__free(dir);
dir = NULL;
}
@@ -225,11 +225,10 @@ int uv_fs_event_start(uv_fs_event_t* handle,
}
if (!handle->buffer) {
- handle->buffer = (char*)_aligned_malloc(uv_directory_watcher_buffer_size,
- sizeof(DWORD));
+ handle->buffer = (char*)uv__malloc(uv_directory_watcher_buffer_size);
}
if (!handle->buffer) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
memset(&(handle->req.u.io.overlapped), 0,
@@ -259,21 +258,21 @@ int uv_fs_event_start(uv_fs_event_t* handle,
error:
if (handle->path) {
- free(handle->path);
+ uv__free(handle->path);
handle->path = NULL;
}
if (handle->filew) {
- free(handle->filew);
+ uv__free(handle->filew);
handle->filew = NULL;
}
if (handle->short_filew) {
- free(handle->short_filew);
+ uv__free(handle->short_filew);
handle->short_filew = NULL;
}
- free(pathw);
+ uv__free(pathw);
if (handle->dir_handle != INVALID_HANDLE_VALUE) {
CloseHandle(handle->dir_handle);
@@ -281,7 +280,7 @@ error:
}
if (handle->buffer) {
- _aligned_free(handle->buffer);
+ uv__free(handle->buffer);
handle->buffer = NULL;
}
@@ -301,22 +300,22 @@ int uv_fs_event_stop(uv_fs_event_t* handle) {
uv__handle_stop(handle);
if (handle->filew) {
- free(handle->filew);
+ uv__free(handle->filew);
handle->filew = NULL;
}
if (handle->short_filew) {
- free(handle->short_filew);
+ uv__free(handle->short_filew);
handle->short_filew = NULL;
}
if (handle->path) {
- free(handle->path);
+ uv__free(handle->path);
handle->path = NULL;
}
if (handle->dirw) {
- free(handle->dirw);
+ uv__free(handle->dirw);
handle->dirw = NULL;
}
@@ -378,9 +377,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
size = wcslen(handle->dirw) +
file_info->FileNameLength / sizeof(WCHAR) + 2;
- filenamew = (WCHAR*)malloc(size * sizeof(WCHAR));
+ filenamew = (WCHAR*)uv__malloc(size * sizeof(WCHAR));
if (!filenamew) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
_snwprintf(filenamew, size, L"%s\\%.*s", handle->dirw,
@@ -393,26 +392,26 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
size = GetLongPathNameW(filenamew, NULL, 0);
if (size) {
- long_filenamew = (WCHAR*)malloc(size * sizeof(WCHAR));
+ long_filenamew = (WCHAR*)uv__malloc(size * sizeof(WCHAR));
if (!long_filenamew) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
size = GetLongPathNameW(filenamew, long_filenamew, size);
if (size) {
long_filenamew[size] = '\0';
} else {
- free(long_filenamew);
+ uv__free(long_filenamew);
long_filenamew = NULL;
}
}
- free(filenamew);
+ uv__free(filenamew);
if (long_filenamew) {
/* Get the file name out of the long path. */
result = uv_split_path(long_filenamew, NULL, &filenamew);
- free(long_filenamew);
+ uv__free(long_filenamew);
if (result == 0) {
long_filenamew = filenamew;
@@ -447,9 +446,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
NULL,
0);
if (size) {
- filename = (char*)malloc(size + 1);
+ filename = (char*)uv__malloc(size + 1);
if (!filename) {
- uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
}
size = uv_utf16_to_utf8(filenamew,
@@ -459,7 +458,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
if (size) {
filename[size] = '\0';
} else {
- free(filename);
+ uv__free(filename);
filename = NULL;
}
}
@@ -478,9 +477,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
break;
}
- free(filename);
+ uv__free(filename);
filename = NULL;
- free(long_filenamew);
+ uv__free(long_filenamew);
long_filenamew = NULL;
}
@@ -519,7 +518,7 @@ void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
if (handle->buffer) {
- _aligned_free(handle->buffer);
+ uv__free(handle->buffer);
handle->buffer = NULL;
}