dovecot-2.2: director: Code cleanup - rename tag to tag_name in ...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Nov 24 09:16:12 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/11a913488054
changeset: 19409:11a913488054
user: Timo Sirainen <tss at iki.fi>
date: Mon Nov 23 19:44:50 2015 +0200
description:
director: Code cleanup - rename tag to tag_name in mail_host_*() parameters.
In preparation for the following changes.
diffstat:
src/director/mail-host.c | 42 ++++++++++++++++++++++--------------------
src/director/mail-host.h | 8 ++++----
2 files changed, 26 insertions(+), 24 deletions(-)
diffs (178 lines):
diff -r 7e47f561ad49 -r 11a913488054 src/director/mail-host.c
--- a/src/director/mail-host.c Mon Nov 23 19:41:38 2015 +0200
+++ b/src/director/mail-host.c Mon Nov 23 19:44:50 2015 +0200
@@ -137,17 +137,17 @@
struct mail_host *
mail_host_add_ip(struct mail_host_list *list, const struct ip_addr *ip,
- const char *tag)
+ const char *tag_name)
{
struct mail_host *host;
- i_assert(tag != NULL);
+ i_assert(tag_name != NULL);
host = i_new(struct mail_host, 1);
host->list = list;
host->vhost_count = VHOST_MULTIPLIER;
host->ip = *ip;
- host->tag = i_strdup(tag);
+ host->tag = i_strdup(tag_name);
array_append(&list->hosts, &host, 1);
list->hosts_unsorted = TRUE;
@@ -156,23 +156,24 @@
struct mail_host *
mail_host_add_hostname(struct mail_host_list *list, const char *hostname,
- const struct ip_addr *ip, const char *tag)
+ const struct ip_addr *ip, const char *tag_name)
{
struct mail_host *host;
- host = mail_host_add_ip(list, ip, tag);
+ host = mail_host_add_ip(list, ip, tag_name);
host->hostname = i_strdup(hostname);
return host;
}
static int
-mail_host_add(struct mail_host_list *list, const char *hostname, const char *tag)
+mail_host_add(struct mail_host_list *list, const char *hostname,
+ const char *tag_name)
{
struct ip_addr *ips, ip;
unsigned int i, ips_count;
if (net_addr2ip(hostname, &ip) == 0) {
- (void)mail_host_add_ip(list, &ip, tag);
+ (void)mail_host_add_ip(list, &ip, tag_name);
return 0;
}
@@ -182,13 +183,14 @@
}
for (i = 0; i < ips_count; i++)
- (void)mail_host_add_hostname(list, hostname, &ips[i], tag);
+ (void)mail_host_add_hostname(list, hostname, &ips[i], tag_name);
return 0;
}
static int
mail_hosts_add_range(struct mail_host_list *list,
- struct ip_addr ip1, struct ip_addr ip2, const char *tag)
+ struct ip_addr ip1, struct ip_addr ip2,
+ const char *tag_name)
{
uint32_t *ip1_arr, *ip2_arr;
uint32_t i1, i2;
@@ -243,7 +245,7 @@
/* create hosts from the final bits */
do {
ip1_arr[i] = ntohl(i1);
- (void)mail_host_add_ip(list, &ip1, tag);
+ (void)mail_host_add_ip(list, &ip1, tag_name);
i1++;
} while (ip1_arr[i] != ip2_arr[i]);
return 0;
@@ -303,12 +305,12 @@
return host->tag;
}
-void mail_host_set_tag(struct mail_host *host, const char *tag)
+void mail_host_set_tag(struct mail_host *host, const char *tag_name)
{
- i_assert(tag != NULL);
+ i_assert(tag_name != NULL);
i_free(host->tag);
- host->tag = i_strdup(tag);
+ host->tag = i_strdup(tag_name);
}
void mail_host_set_down(struct mail_host *host, bool down, time_t timestamp)
@@ -368,7 +370,7 @@
static struct mail_host *
mail_host_get_by_hash_ring(struct mail_host_list *list, unsigned int hash,
- const char *tag)
+ const char *tag_name)
{
struct mail_host *host;
const struct mail_vhost *vhosts;
@@ -386,7 +388,7 @@
for (i = 0; i < count; i++) {
host = vhosts[(idx + i) % count].host;
- if (strcmp(host->tag, tag) == 0)
+ if (strcmp(host->tag, tag_name) == 0)
return host;
}
return NULL;
@@ -394,7 +396,7 @@
static struct mail_host *
mail_host_get_by_hash_direct(struct mail_host_list *list, unsigned int hash,
- const char *tag)
+ const char *tag_name)
{
struct mail_host *host;
const struct mail_vhost *vhosts;
@@ -406,7 +408,7 @@
for (i = 0; i < count; i++) {
host = vhosts[(hash + i) % count].host;
- if (strcmp(host->tag, tag) == 0)
+ if (strcmp(host->tag, tag_name) == 0)
return host;
}
return NULL;
@@ -414,15 +416,15 @@
struct mail_host *
mail_host_get_by_hash(struct mail_host_list *list, unsigned int hash,
- const char *tag)
+ const char *tag_name)
{
if (list->hosts_unsorted)
mail_hosts_sort(list);
if (list->consistent_hashing)
- return mail_host_get_by_hash_ring(list, hash, tag);
+ return mail_host_get_by_hash_ring(list, hash, tag_name);
else
- return mail_host_get_by_hash_direct(list, hash, tag);
+ return mail_host_get_by_hash_direct(list, hash, tag_name);
}
void mail_hosts_set_synced(struct mail_host_list *list)
diff -r 7e47f561ad49 -r 11a913488054 src/director/mail-host.h
--- a/src/director/mail-host.h Mon Nov 23 19:41:38 2015 +0200
+++ b/src/director/mail-host.h Mon Nov 23 19:44:50 2015 +0200
@@ -26,20 +26,20 @@
struct mail_host *
mail_host_add_ip(struct mail_host_list *list, const struct ip_addr *ip,
- const char *tag);
+ const char *tag_name);
struct mail_host *
mail_host_add_hostname(struct mail_host_list *list, const char *hostname,
- const struct ip_addr *ip, const char *tag);
+ const struct ip_addr *ip, const char *tag_name);
struct mail_host *
mail_host_lookup(struct mail_host_list *list, const struct ip_addr *ip);
struct mail_host *
mail_host_get_by_hash(struct mail_host_list *list, unsigned int hash,
- const char *tag);
+ const char *tag_name);
int mail_hosts_parse_and_add(struct mail_host_list *list,
const char *hosts_string);
const char *mail_host_get_tag(struct mail_host *host);
-void mail_host_set_tag(struct mail_host *host, const char *tag);
+void mail_host_set_tag(struct mail_host *host, const char *tag_name);
void mail_host_set_down(struct mail_host *host, bool down, time_t timestamp);
void mail_host_set_vhost_count(struct mail_host *host,
unsigned int vhost_count);
More information about the dovecot-cvs
mailing list