clang-format

pull/774/head
Brad House 6 months ago
parent 75f6a6fab4
commit 25ad4ca231
  1. 4
      src/lib/ares__htable_vpvp.c
  2. 2
      src/lib/ares__htable_vpvp.h
  3. 4
      src/lib/ares__threads.c
  4. 4
      src/lib/ares__timeval.c
  5. 2
      src/lib/ares_event_configchg.c
  6. 3
      src/lib/ares_private.h
  7. 32
      src/lib/ares_process.c
  8. 6
      src/lib/ares_str.c
  9. 3
      src/lib/ares_sysconfig_mac.c
  10. 1
      src/lib/ares_timeout.c
  11. 2
      src/lib/ares_update_servers.c

@ -171,7 +171,7 @@ ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable,
}
void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
const void *key)
const void *key)
{
void *val = NULL;
ares__htable_vpvp_get(htable, key, &val);
@ -179,7 +179,7 @@ void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
}
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable,
const void *key)
const void *key)
{
if (htable == NULL) {
return ARES_FALSE;

@ -114,7 +114,7 @@ void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
* \return ARES_TRUE if found, ARES_FALSE if not
*/
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable,
const void *key);
const void *key);
/*! Retrieve the number of keys stored in the hash table
*

@ -577,8 +577,8 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
unsigned long tms;
ares__timeval_remaining(&tv_remaining, &tv_now, &tout);
tms = (unsigned long)((tv_remaining.sec * 1000) +
(tv_remaining.usec / 1000));
tms =
(unsigned long)((tv_remaining.sec * 1000) + (tv_remaining.usec / 1000));
if (tms == 0) {
status = ARES_ETIMEOUT;
} else {

@ -36,8 +36,8 @@ ares_timeval_t ares__tvnow(void)
ares_timeval_t now;
ULONGLONG milliseconds = GetTickCount64();
now.sec = (ares_int64_t)milliseconds / 1000;
now.usec = (unsigned int)(milliseconds % 1000) * 1000;
now.sec = (ares_int64_t)milliseconds / 1000;
now.usec = (unsigned int)(milliseconds % 1000) * 1000;
return now;
}

@ -88,7 +88,7 @@ static void ares_event_configchg_cb(ares_event_thread_t *e, ares_socket_t fd,
* decrease performance. Hence, the buffer used for reading from
* the inotify file descriptor should have the same alignment as
* struct inotify_event. */
unsigned char buf[4096]
unsigned char buf[4096]
__attribute__((aligned(__alignof__(struct inotify_event))));
const struct inotify_event *event;
ssize_t len;

@ -379,7 +379,8 @@ ares_bool_t ares__timedout(const ares_timeval_t *now,
/* Returns one of the normal ares status codes like ARES_SUCCESS */
ares_status_t ares__send_query(struct query *query, const ares_timeval_t *now);
ares_status_t ares__requeue_query(struct query *query, const ares_timeval_t *now);
ares_status_t ares__requeue_query(struct query *query,
const ares_timeval_t *now);
/*! Retrieve a list of names to use for searching. The first successful
* query in the list wins. This function also uses the HOSTSALIASES file

@ -50,15 +50,14 @@
#include "ares_nameser.h"
#include "ares_dns.h"
static void timeadd(ares_timeval_t *now, size_t millisecs);
static ares_bool_t try_again(int errnum);
static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds,
ares_socket_t write_fd);
static void read_packets(ares_channel_t *channel, fd_set *read_fds,
ares_socket_t read_fd,
const ares_timeval_t *now);
static void process_timeouts(ares_channel_t *channel,
const ares_timeval_t *now);
static void timeadd(ares_timeval_t *now, size_t millisecs);
static ares_bool_t try_again(int errnum);
static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds,
ares_socket_t write_fd);
static void read_packets(ares_channel_t *channel, fd_set *read_fds,
ares_socket_t read_fd, const ares_timeval_t *now);
static void process_timeouts(ares_channel_t *channel,
const ares_timeval_t *now);
static ares_status_t process_answer(ares_channel_t *channel,
const unsigned char *abuf, size_t alen,
struct server_connection *conn,
@ -71,8 +70,7 @@ static ares_bool_t same_questions(const ares_dns_record_t *qrec,
static ares_bool_t same_address(const struct sockaddr *sa,
const struct ares_addr *aa);
static void end_query(ares_channel_t *channel, struct query *query,
ares_status_t status,
const ares_dns_record_t *dnsrec);
ares_status_t status, const ares_dns_record_t *dnsrec);
/* Invoke the server state callback after a success or failure */
static void invoke_server_state_cb(const struct server_state *server,
@ -182,7 +180,7 @@ static void timeadd(ares_timeval_t *now, size_t millisecs)
now->usec += (unsigned int)((millisecs % 1000) * 1000);
if (now->usec >= 1000000) {
now->sec += now->usec / 1000000;
now->sec += now->usec / 1000000;
now->usec %= 1000000;
}
}
@ -818,7 +816,8 @@ static void handle_conn_error(struct server_connection *conn,
ares__close_connection(conn);
}
ares_status_t ares__requeue_query(struct query *query, const ares_timeval_t *now)
ares_status_t ares__requeue_query(struct query *query,
const ares_timeval_t *now)
{
ares_channel_t *channel = query->channel;
size_t max_tries = ares__slist_len(channel->servers) * channel->tries;
@ -887,11 +886,10 @@ static struct server_state *ares__random_server(ares_channel_t *channel)
*/
static struct server_state *ares__failover_server(ares_channel_t *channel)
{
struct server_state *first_server =
ares__slist_first_val(channel->servers);
const struct server_state *last_server =
struct server_state *first_server = ares__slist_first_val(channel->servers);
const struct server_state *last_server =
ares__slist_last_val(channel->servers);
unsigned short r;
unsigned short r;
/* Defensive code against no servers being available on the channel. */
if (first_server == NULL) {

@ -261,8 +261,9 @@ ares_bool_t ares__is_hostname(const char *str)
{
size_t i;
if (str == NULL)
if (str == NULL) {
return ARES_FALSE;
}
for (i = 0; str[i] != 0; i++) {
if (!ares__is_hostnamech(str[i])) {
@ -276,8 +277,9 @@ ares_bool_t ares__str_isprint(const char *str, size_t len)
{
size_t i;
if (str == NULL && len != 0)
if (str == NULL && len != 0) {
return ARES_FALSE;
}
for (i = 0; i < len; i++) {
if (!ares__isprint(str[i])) {

@ -187,8 +187,7 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
if (search_is_duplicate(sysconfig, search)) {
continue;
}
sysconfig->domains[sysconfig->ndomains] =
ares_strdup(search);
sysconfig->domains[sysconfig->ndomains] = ares_strdup(search);
if (sysconfig->domains[sysconfig->ndomains] == NULL) {
return ARES_ENOMEM;
}

@ -65,7 +65,6 @@ static struct timeval ares_timeval_to_struct_timeval(const ares_timeval_t *atv)
return tv;
}
static ares_timeval_t struct_timeval_to_ares_timeval(const struct timeval *tv)
{
ares_timeval_t atv;

@ -675,7 +675,7 @@ static ares_bool_t ares__servers_remove_stale(ares_channel_t *channel,
ares__llist_t *srvlist)
{
ares_bool_t stale_removed = ARES_FALSE;
ares__slist_node_t *snode = ares__slist_node_first(channel->servers);
ares__slist_node_t *snode = ares__slist_node_first(channel->servers);
while (snode != NULL) {
ares__slist_node_t *snext = ares__slist_node_next(snode);

Loading…
Cancel
Save