Skip to content

Commit

Permalink
New overload for ...create_address
Browse files Browse the repository at this point in the history
* New overload for chif_net_create_address called chif_net_create_address_i, which enables you to pass it a chif_net_port instead of a string for port number.
* Removed const on values in the header.
* Ran clang format
  • Loading branch information
dumheter committed Oct 11, 2019
1 parent 47dacc0 commit 55c41be
Show file tree
Hide file tree
Showing 4 changed files with 705 additions and 693 deletions.
20 changes: 19 additions & 1 deletion chif_net/chif_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,8 @@ chif_net_poll(chif_net_check* check,
const int timeout_ms)
{
#if defined(CHIF_NET_WINSOCK2)
*ready_count_out = WSAPoll((struct pollfd*)check, (ULONG)check_count, timeout_ms);
*ready_count_out =
WSAPoll((struct pollfd*)check, (ULONG)check_count, timeout_ms);
#else
*ready_count_out = poll((struct pollfd*)check, check_count, timeout_ms);
#endif
Expand Down Expand Up @@ -958,6 +959,23 @@ chif_net_create_address(chif_net_address* address_out,
return CHIF_NET_RESULT_SUCCESS;
}

chif_net_result
chif_net_create_address_i(chif_net_address* address_out,
const char* name,
chif_net_port port,
const chif_net_address_family address_family,
const chif_net_transport_protocol transport_protocol)
{
enum
{
portstrlen = 6
};
char portstr[portstrlen];
snprintf(portstr, portstrlen, "%u", port);
return chif_net_create_address(
address_out, name, portstr, address_family, transport_protocol);
}

chif_net_result
chif_net_address_from_socket(const chif_net_socket socket,
chif_net_address* address_out)
Expand Down
Loading

0 comments on commit 55c41be

Please sign in to comment.