clang-format

pull/797/head
Brad House 8 months ago
parent c2b91beaef
commit bbcb1a2bdf
  1. 3
      src/lib/ares__hosts_file.c
  2. 6
      src/lib/ares__iface_ips.c
  3. 14
      src/lib/ares_dns_mapping.c
  4. 41
      src/lib/ares_event_configchg.c
  5. 3
      src/lib/ares_gethostbyaddr.c
  6. 4
      src/lib/ares_getnameinfo.c
  7. 6
      src/lib/ares_metrics.c
  8. 6
      src/lib/ares_private.h
  9. 1
      src/lib/ares_process.c
  10. 1
      src/lib/ares_rand.c
  11. 3
      src/lib/ares_sysconfig_mac.c
  12. 3
      src/lib/ares_timeout.c
  13. 1
      test/ares_queryloop.c

@ -617,7 +617,8 @@ static ares_bool_t ares__hosts_expired(const char *filename,
/* Expire every 60s if we can't get a time */
if (mod_ts == 0) {
mod_ts = time(NULL) - 60; /* LCOV_EXCL_LINE: only on systems without stat() */
mod_ts =
time(NULL) - 60; /* LCOV_EXCL_LINE: only on systems without stat() */
}
/* If filenames are different, its expired */

@ -529,8 +529,9 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips,
unsigned int ares__if_nametoindex(const char *name)
{
#ifdef HAVE_IF_NAMETOINDEX
if (name == NULL)
if (name == NULL) {
return 0;
}
return if_nametoindex(name);
#else
ares_status_t status;
@ -538,8 +539,9 @@ unsigned int ares__if_nametoindex(const char *name)
size_t i;
unsigned int index = 0;
if (name == NULL)
if (name == NULL) {
return 0;
}
status =
ares__iface_ips(&ips, ARES_IFACE_IP_V6 | ARES_IFACE_IP_LINKLOCAL, name);

@ -548,15 +548,11 @@ static const ares_dns_rr_key_t rr_hinfo_keys[] = { ARES_RR_HINFO_CPU,
ARES_RR_HINFO_OS };
static const ares_dns_rr_key_t rr_mx_keys[] = { ARES_RR_MX_PREFERENCE,
ARES_RR_MX_EXCHANGE };
static const ares_dns_rr_key_t rr_sig_keys[] = { ARES_RR_SIG_TYPE_COVERED,
ARES_RR_SIG_ALGORITHM,
ARES_RR_SIG_LABELS,
ARES_RR_SIG_ORIGINAL_TTL,
ARES_RR_SIG_EXPIRATION,
ARES_RR_SIG_INCEPTION,
ARES_RR_SIG_KEY_TAG,
ARES_RR_SIG_SIGNERS_NAME,
ARES_RR_SIG_SIGNATURE };
static const ares_dns_rr_key_t rr_sig_keys[] = {
ARES_RR_SIG_TYPE_COVERED, ARES_RR_SIG_ALGORITHM, ARES_RR_SIG_LABELS,
ARES_RR_SIG_ORIGINAL_TTL, ARES_RR_SIG_EXPIRATION, ARES_RR_SIG_INCEPTION,
ARES_RR_SIG_KEY_TAG, ARES_RR_SIG_SIGNERS_NAME, ARES_RR_SIG_SIGNATURE
};
static const ares_dns_rr_key_t rr_txt_keys[] = { ARES_RR_TXT_DATA };
static const ares_dns_rr_key_t rr_aaaa_keys[] = { ARES_RR_AAAA_ADDR };
static const ares_dns_rr_key_t rr_srv_keys[] = {

@ -250,25 +250,22 @@ static void ares_event_configchg_ip_cb(PVOID CallerContext,
}
# endif
static ares_bool_t ares_event_configchg_regnotify(ares_event_configchg_t *configchg)
static ares_bool_t
ares_event_configchg_regnotify(ares_event_configchg_t *configchg)
{
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC)
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L
# endif
DWORD flags =
REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_THREAD_AGNOSTIC;
DWORD flags = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET |
REG_NOTIFY_THREAD_AGNOSTIC;
if (RegNotifyChangeKeyValue(configchg->regip4, TRUE,
flags,
configchg->regip4_event,
TRUE) != ERROR_SUCCESS) {
if (RegNotifyChangeKeyValue(configchg->regip4, TRUE, flags,
configchg->regip4_event, TRUE) != ERROR_SUCCESS) {
return ARES_FALSE;
}
if (RegNotifyChangeKeyValue(configchg->regip6, TRUE,
flags,
configchg->regip6_event,
TRUE) != ERROR_SUCCESS) {
if (RegNotifyChangeKeyValue(configchg->regip6, TRUE, flags,
configchg->regip6_event, TRUE) != ERROR_SUCCESS) {
return ARES_FALSE;
}
@ -318,14 +315,16 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
/* Monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces
* and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
* for changes via RegNotifyChangeKeyValue() */
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces",
0, KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) {
if (RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", 0,
KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) {
status = ARES_ESERVFAIL;
goto done;
}
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
if (RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces",
0, KEY_NOTIFY, &c->regip6) != ERROR_SUCCESS) {
status = ARES_ESERVFAIL;
@ -345,13 +344,15 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
}
if (!RegisterWaitForSingleObject(&c->regip4_wait, c->regip4_event,
ares_event_configchg_reg_cb, c, INFINITE, WT_EXECUTEDEFAULT)) {
ares_event_configchg_reg_cb, c, INFINITE,
WT_EXECUTEDEFAULT)) {
status = ARES_ESERVFAIL;
goto done;
}
if (!RegisterWaitForSingleObject(&c->regip6_wait, c->regip6_event,
ares_event_configchg_reg_cb, c, INFINITE, WT_EXECUTEDEFAULT)) {
ares_event_configchg_reg_cb, c, INFINITE,
WT_EXECUTEDEFAULT)) {
status = ARES_ESERVFAIL;
goto done;
}
@ -454,7 +455,8 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
size_t i;
const char *searchlibs[] = {
"/usr/lib/libSystem.dylib",
"/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration",
"/System/Library/Frameworks/SystemConfiguration.framework/"
"SystemConfiguration",
NULL
};
@ -471,7 +473,8 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
continue;
}
pdns_configuration_notify_key = dlsym(handle, "dns_configuration_notify_key");
pdns_configuration_notify_key =
dlsym(handle, "dns_configuration_notify_key");
if (pdns_configuration_notify_key != NULL) {
break;
}

@ -132,7 +132,8 @@ static void next_lookup(struct addr_query *aquery)
case 'b':
name = ares_dns_addr_to_ptr(&aquery->addr);
if (name == NULL) {
end_aquery(aquery, ARES_ENOMEM, NULL); /* LCOV_EXCL_LINE: OutOfMemory */
end_aquery(aquery, ARES_ENOMEM,
NULL); /* LCOV_EXCL_LINE: OutOfMemory */
return; /* LCOV_EXCL_LINE: OutOfMemory */
}
aquery->remaining_lookups = p + 1;

@ -81,8 +81,8 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
static char *lookup_service(unsigned short port, unsigned int flags, char *buf,
size_t buflen);
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
static void append_scopeid(const struct sockaddr_in6 *addr6,
unsigned int flags, char *buf, size_t buflen);
static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags,
char *buf, size_t buflen);
#endif
static char *ares_striendstr(const char *s1, const char *s2);

@ -227,10 +227,12 @@ size_t ares_metrics_server_timeout(const struct server_state *server,
continue;
}
/* Calculate average time for previous bucket */
timeout_ms = (size_t)(server->metrics[i].prev_total_ms / server->metrics[i].prev_total_count);
timeout_ms = (size_t)(server->metrics[i].prev_total_ms /
server->metrics[i].prev_total_count);
} else {
/* Calculate average time for current bucket*/
timeout_ms = (size_t)(server->metrics[i].total_ms / server->metrics[i].total_count);
timeout_ms =
(size_t)(server->metrics[i].total_ms / server->metrics[i].total_count);
}
/* Multiply average by constant to get timeout value */

@ -189,7 +189,8 @@ typedef struct {
ares_uint64_t total_count; /*!< Number of queries for bucket */
time_t prev_ts; /*!< Previous period bucket timestamp */
ares_uint64_t prev_total_ms; /*!< Previous period bucket cumulative query time */
ares_uint64_t
prev_total_ms; /*!< Previous period bucket cumulative query time */
ares_uint64_t prev_total_count; /*!< Previous period bucket query count */
} ares_server_metrics_t;
@ -437,8 +438,7 @@ ares_timeval_t ares__tvnow(void);
void ares__timeval_remaining(ares_timeval_t *remaining,
const ares_timeval_t *now,
const ares_timeval_t *tout);
void ares__timeval_diff(ares_timeval_t *tvdiff,
const ares_timeval_t *tvstart,
void ares__timeval_diff(ares_timeval_t *tvdiff, const ares_timeval_t *tvstart,
const ares_timeval_t *tvstop);
ares_status_t ares__expand_name_validated(const unsigned char *encoded,
const unsigned char *abuf,

@ -1253,7 +1253,6 @@ static void ares_detach_query(struct query *query)
query->node_all_queries = NULL;
}
static void end_query(ares_channel_t *channel, struct server_state *server,
struct query *query, ares_status_t status,
const ares_dns_record_t *dnsrec)

@ -335,7 +335,6 @@ static void ares__rand_bytes_fetch(ares_rand_state *state, unsigned char *buf,
return;
/* LCOV_EXCL_STOP */
}
/* If we didn't return before we got here, that means we had a critical rand

@ -85,7 +85,8 @@ static ares_status_t dnsinfo_init(dnsinfo_t **dnsinfo_out)
size_t i;
const char *searchlibs[] = {
"/usr/lib/libSystem.dylib",
"/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration",
"/System/Library/Frameworks/SystemConfiguration.framework/"
"SystemConfiguration",
NULL
};

@ -55,8 +55,7 @@ void ares__timeval_remaining(ares_timeval_t *remaining,
}
}
void ares__timeval_diff(ares_timeval_t *tvdiff,
const ares_timeval_t *tvstart,
void ares__timeval_diff(ares_timeval_t *tvdiff, const ares_timeval_t *tvstart,
const ares_timeval_t *tvstop)
{
tvdiff->sec = tvstop->sec - tvstart->sec;

@ -77,7 +77,6 @@ static void ai_callback(void *arg, int status, int timeouts,
ares_freeaddrinfo(result);
}
static volatile ares_bool_t is_running = ARES_TRUE;

Loading…
Cancel
Save