Skip to content

Commit

Permalink
use new amalgamate tool
Browse files Browse the repository at this point in the history
  • Loading branch information
qgymib committed Aug 1, 2024
1 parent 188cbaa commit afd070e
Show file tree
Hide file tree
Showing 9 changed files with 658 additions and 642 deletions.
318 changes: 163 additions & 155 deletions ev.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/ev/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ const char* ev_strerror(int err)

switch (err)
{
/* Success */
case 0: return "Operation success";
/* Success */
case 0: return "Operation success";
case EV_EOF: return "End of file";
/* posix */
EV_ERRNO_POSIX_MAP(EV_EXPAND_ERRMAP);
Expand Down
10 changes: 5 additions & 5 deletions src/ev/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ int ev_ip_addr(const char* ip, int port, struct sockaddr* addr, size_t size)

int ev_ip_name(const struct sockaddr* addr, int* port, char* ip, size_t len)
{
if (addr->sa_family == AF_INET)
{
return ev_ipv4_name((struct sockaddr_in*)addr, port, ip, len);
}
return ev_ipv6_name((struct sockaddr_in6*)addr, port, ip, len);
if (addr->sa_family == AF_INET)
{
return ev_ipv4_name((struct sockaddr_in*)addr, port, ip, len);
}
return ev_ipv6_name((struct sockaddr_in6*)addr, port, ip, len);
}

ev_buf_t ev_buf_make(void* buf, size_t len)
Expand Down
2 changes: 1 addition & 1 deletion src/ev/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ EV_LOCAL void ev__init_timer(ev_loop_t* loop);
/**
* @brief Process timer.
* @param[in] loop Event loop
* @return Active counter
* @return Active counter
*/
EV_LOCAL size_t ev__process_timer(ev_loop_t* loop);

Expand Down
32 changes: 16 additions & 16 deletions src/ev/win/fs_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,10 @@ EV_LOCAL ssize_t ev__fs_readv(ev_os_file_t file, ev_buf_t* bufs, size_t nbuf)
{
DWORD errcode;
DWORD bytes = 0;
if (file == INVALID_HANDLE_VALUE)
{
return ev__translate_sys_error(ERROR_INVALID_HANDLE);
}
if (file == INVALID_HANDLE_VALUE)
{
return ev__translate_sys_error(ERROR_INVALID_HANDLE);
}

size_t idx;
for (idx = 0; idx < nbuf; idx++)
Expand All @@ -621,11 +621,11 @@ EV_LOCAL ssize_t ev__fs_readv(ev_os_file_t file, ev_buf_t* bufs, size_t nbuf)
return bytes;
}

if (errcode == ERROR_ACCESS_DENIED)
{
if (errcode == ERROR_ACCESS_DENIED)
{
errcode = ERROR_INVALID_FLAGS;
}
return ev__translate_sys_error(errcode);
}
return ev__translate_sys_error(errcode);
}

EV_LOCAL ssize_t ev__fs_preadv(ev_os_file_t file, ev_buf_t* bufs, size_t nbuf, ssize_t offset)
Expand Down Expand Up @@ -676,10 +676,10 @@ EV_LOCAL ssize_t ev__fs_writev(ev_os_file_t file, ev_buf_t* bufs, size_t nbuf)
{
DWORD errcode;
DWORD bytes = 0;
if (file == INVALID_HANDLE_VALUE)
{
return ev__translate_sys_error(ERROR_INVALID_HANDLE);
}
if (file == INVALID_HANDLE_VALUE)
{
return ev__translate_sys_error(ERROR_INVALID_HANDLE);
}

size_t idx;
for (idx = 0; idx < nbuf; idx++)
Expand All @@ -699,11 +699,11 @@ EV_LOCAL ssize_t ev__fs_writev(ev_os_file_t file, ev_buf_t* bufs, size_t nbuf)

error:
errcode = GetLastError();
if (errcode == ERROR_ACCESS_DENIED)
{
if (errcode == ERROR_ACCESS_DENIED)
{
errcode = ERROR_INVALID_FLAGS;
}
return ev__translate_sys_error(errcode);
}
return ev__translate_sys_error(errcode);
}

EV_LOCAL ssize_t ev__fs_pwritev(ev_os_file_t file, ev_buf_t* bufs, size_t nbuf, ssize_t offset)
Expand Down
14 changes: 11 additions & 3 deletions src/ev/win/misc_win.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef __EV_MISC_WIN_INTERNAL_H__
#define __EV_MISC_WIN_INTERNAL_H__

#define EV_FATAL_SYSCALL(errcode, syscall) \
ev__fatal_syscall(__FILE__, __LINE__, errcode, syscall)
#define EV_FATAL_SYSCALL(errcode, syscall) \
ev__fatal_syscall(__FILE__, __LINE__, errcode, syscall)

#ifdef __cplusplus
extern "C" {
Expand All @@ -24,8 +24,16 @@ EV_LOCAL ssize_t ev__utf8_to_wide(WCHAR** dst, const char* src);
*/
EV_LOCAL ssize_t ev__wide_to_utf8(char** dst, const WCHAR* src);

/**
* @brief Show fatal information about syscall and abort().
* @warning This function does not return.
* @param[in] file File path.
* @param[in] line The line number.
* @param[in] errcode Error code from GetLastError().
* @param[in] syscall The name of syscall.
*/
EV_LOCAL void ev__fatal_syscall(const char* file, int line,
DWORD errcode, const char* syscall);
DWORD errcode, const char* syscall);

#ifdef __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions src/ev/win/process_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ static void _ev_process_on_sigchild_win(ev_async_t* async)
process->exit_code = ev__translate_sys_error(status);
}

if (process->sigchild_cb != NULL)
{
process->sigchild_cb(process, process->exit_status, process->exit_code);
}
if (process->sigchild_cb != NULL)
{
process->sigchild_cb(process, process->exit_status, process->exit_code);
}
}

static int _ev_process_setup_start_info(ev_startup_info_t* start_info,
Expand Down
Loading

0 comments on commit afd070e

Please sign in to comment.