clang-format

pull/603/head
Brad House 1 year ago
parent 9037340ef6
commit 80fdc96f9a
  1. 3
      include/ares.h
  2. 34
      src/lib/ares__buf.c
  3. 3
      src/lib/ares__slist.c
  4. 3
      src/lib/ares__slist.h
  5. 3
      src/lib/ares_dns_name.c
  6. 2
      src/lib/ares_dns_parse.c
  7. 1
      src/lib/ares_dns_record.h
  8. 4
      test/ares-test.h

@ -705,7 +705,8 @@ struct ares_addr_port_node {
CARES_EXTERN int ares_set_servers(ares_channel_t *channel,
const struct ares_addr_node *servers);
CARES_EXTERN int ares_set_servers_ports(ares_channel_t *channel,
CARES_EXTERN int
ares_set_servers_ports(ares_channel_t *channel,
const struct ares_addr_port_node *servers);
/* Incomming string format: host[:port][,host[:port]]... */

@ -838,12 +838,13 @@ static ares_status_t ares__buf_append_num_hex(ares__buf_t *buf, size_t num,
{
size_t i;
static const unsigned char hexbytes[] = "0123456789ABCDEF";
for (i=len; i>0; i--) {
for (i = len; i > 0; i--) {
ares_status_t status;
status = ares__buf_append_byte(buf, hexbytes[(num >> ((i-1) * 4)) & 0xF]);
if (status != ARES_SUCCESS)
status = ares__buf_append_byte(buf, hexbytes[(num >> ((i - 1) * 4)) & 0xF]);
if (status != ARES_SUCCESS) {
return status;
}
}
return ARES_SUCCESS;
}
@ -858,46 +859,53 @@ ares_status_t ares__buf_hexdump(ares__buf_t *buf, const unsigned char *data,
size_t i;
ares_status_t status;
/* Each line is 16 bytes */
for (i=0; i<len; i += 16) {
for (i = 0; i < len; i += 16) {
size_t j;
/* Address */
status = ares__buf_append_num_hex(buf, i, 6);
if (status != ARES_SUCCESS)
if (status != ARES_SUCCESS) {
return status;
}
/* | */
status = ares__buf_append_str(buf, " | ");
if (status != ARES_SUCCESS)
if (status != ARES_SUCCESS) {
return status;
}
for (j=i; j<i+16; j++) {
for (j = i; j < i + 16; j++) {
if (j >= len) {
status = ares__buf_append_str(buf, " ");
} else {
status = ares__buf_append_num_hex(buf, data[j], 2);
}
if (status != ARES_SUCCESS)
if (status != ARES_SUCCESS) {
return status;
}
status = ares__buf_append_byte(buf, ' ');
if (status != ARES_SUCCESS)
if (status != ARES_SUCCESS) {
return status;
}
}
/* | */
status = ares__buf_append_str(buf, " | ");
if (status != ARES_SUCCESS)
if (status != ARES_SUCCESS) {
return status;
}
for (j=i; j<i+16; j++) {
for (j = i; j < i + 16; j++) {
if (j >= len) {
break;
}
status = ares__buf_append_byte(buf, ares__isprint(data[j])?data[j]:'.');
if (status != ARES_SUCCESS)
status =
ares__buf_append_byte(buf, ares__isprint(data[j]) ? data[j] : '.');
if (status != ARES_SUCCESS) {
return status;
}
}
ares__buf_append_byte(buf, '\n');
}

@ -318,8 +318,7 @@ void ares__slist_node_reinsert(ares__slist_node_t *node)
ares__slist_node_push(list, node);
}
ares__slist_node_t *ares__slist_node_find(ares__slist_t *list,
const void *val)
ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val)
{
size_t i;
ares__slist_node_t *node = NULL;

@ -135,8 +135,7 @@ ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node);
* \param[in] val Object to use for comparison
* \return SkipList Node Object or NULL if not found
*/
ares__slist_node_t *ares__slist_node_find(ares__slist_t *list,
const void *val);
ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val);
/*! Fetch Node Value

@ -175,7 +175,8 @@ static ares__buf_t *ares_dns_labels_add(ares_dns_labels_t *labels)
return labels->label[labels->num - 1];
}
static const ares__buf_t *ares_dns_labels_get_last(const ares_dns_labels_t *labels)
static const ares__buf_t *
ares_dns_labels_get_last(const ares_dns_labels_t *labels)
{
if (labels == NULL || labels->num == 0) {
return NULL;

@ -422,7 +422,6 @@ static ares_status_t ares_dns_parse_rr_opt(ares__buf_t *buf, ares_dns_rr_t *rr,
return ARES_SUCCESS;
}
static ares_status_t ares_dns_parse_rr_tlsa(ares__buf_t *buf, ares_dns_rr_t *rr,
size_t rdlength)
{
@ -465,7 +464,6 @@ static ares_status_t ares_dns_parse_rr_tlsa(ares__buf_t *buf, ares_dns_rr_t *rr,
return ARES_SUCCESS;
}
static ares_status_t ares_dns_parse_rr_uri(ares__buf_t *buf, ares_dns_rr_t *rr,
size_t rdlength)
{

@ -275,7 +275,6 @@ typedef enum {
ARES_TLSA_MATCH_SHA512 = 2
} ares_tlsa_match_t;
/*! String representation of DNS Record Type
*
* \param[in] type DNS Record Type

4
test/ares-test.h vendored

@ -67,7 +67,7 @@ extern std::vector<std::pair<int, bool>> families_modes;
// Process all pending work on ares-owned file descriptors, plus
// optionally the given set-of-FDs + work function.
void ProcessWork(ares_channel_t * channel,
void ProcessWork(ares_channel_t *channel,
std::function<std::set<int>()> get_extrafds,
std::function<void(int)> process_extra);
std::set<int> NoExtraFDs();
@ -278,7 +278,7 @@ protected:
NiceMockServers servers_;
// Convenience reference to first server.
NiceMockServer &server_;
ares_channel_t * channel_;
ares_channel_t *channel_;
};
class MockChannelTest

Loading…
Cancel
Save