void mail_index_append(struct mail_index_transaction *t, uint32_t uid,
uint32_t *seq_r)
{
- struct mail_index_record *rec;
+ struct mail_index_record *rec;
i_assert(!t->no_appends);
uint32_t ext_id, const void *data, void *old_data_r)
{
struct mail_index *index = t->view->index;
- const struct mail_index_registered_ext *rext;
+ const struct mail_index_registered_ext *rext;
const struct mail_transaction_ext_intro *intro;
uint16_t record_size;
ARRAY_TYPE(seq_array) *array;
return TRUE;
} else {
/* insert */
- p = array_insert_space(array, idx);
+ p = array_insert_space(array, idx);
memcpy(p, &seq, sizeof(seq));
memcpy(PTR_OFFSET(p, sizeof(seq)), record, record_size);
return FALSE;
bool mail_index_ext_lookup(struct mail_index *index, const char *name,
uint32_t *ext_id_r)
{
- const struct mail_index_registered_ext *extensions;
+ const struct mail_index_registered_ext *extensions;
unsigned int i, count;
extensions = array_get(&index->extensions, &count);
i_assert(index->fd == -1);
i_assert(!MAIL_INDEX_IS_IN_MEMORY(index));
- /* Note that our caller must close index->fd by itself. */
+ /* Note that our caller must close index->fd by itself. */
if (index->readonly)
errno = EACCES;
else {
{
int ret;
- i_assert(index->fd == -1);
+ i_assert(index->fd == -1);
if (MAIL_INDEX_IS_IN_MEMORY(index))
return 0;
int mail_index_create_tmp_file(struct mail_index *index,
const char *path_prefix, const char **path_r)
{
- mode_t old_mask;
+ mode_t old_mask;
const char *path;
int fd;
unsigned int count;
int refcount;
- /* variable sized list of keyword indexes */
+ /* variable sized list of keyword indexes */
unsigned int idx[FLEXIBLE_ARRAY_MEMBER];
};
struct foo *foo = array_idx(foos, 0);
}
struct foo_manager {
- ARRAY_TYPE(foo) foos; // pedantically, ARRAY(struct foo) is a different type
+ ARRAY_TYPE(foo) foos; // pedantically, ARRAY(struct foo) is a different type
};
// ...
- do_foo(&my_foo_manager->foos); // No compiler warning about mismatched types
+ do_foo(&my_foo_manager->foos); // No compiler warning about mismatched types
*/
#include "array-decl.h"
buffer_set_used_size(buf, 0);
}
}
-
}
}
- lock_info->temp_path = str_c(tmp_path);
+ lock_info->temp_path = str_c(tmp_path);
} else if (fstat(lock_info->fd, &st) < 0) {
i_error("fstat(%s) failed: %m", lock_info->temp_path);
return -1;
dotlock->ino = st.st_ino;
dotlock->fd = lock_info.fd;
- dotlock->lock_time = now;
+ dotlock->lock_time = now;
lock_info.fd = -1;
if (st.st_ctime + MAX_TIME_DIFF < now ||
{
struct dotlock *dotlock;
const char *lock_path;
- struct stat st;
+ struct stat st;
int ret;
dotlock = *dotlock_p;
static inline unsigned short i_rand_ushort(void)
{
- return i_rand_limit(USHRT_MAX + 1);
+ return i_rand_limit(USHRT_MAX + 1);
}
static inline unsigned char i_rand_uchar(void)
{
- return i_rand_limit(UCHAR_MAX + 1);
+ return i_rand_limit(UCHAR_MAX + 1);
}
/* Returns a random integer >= min_val, and <= max_val. */
return ret;
}
#endif
- return faccessat(fd, file, type, flag);
+ return faccessat(fd, file, type, flag);
}
#endif
unsigned int net_ip_hash(const struct ip_addr *ip)
{
- const unsigned char *p;
+ const unsigned char *p;
unsigned int len, g, h = 0;
if (ip->family == AF_INET6) {
static inline void sin_set_port(union sockaddr_union *so, in_port_t port)
{
if (so->sin.sin_family == AF_INET6)
- so->sin6.sin6_port = htons(port);
+ so->sin6.sin6_port = htons(port);
else if (so->sin.sin_family == AF_INET)
so->sin.sin_port = htons(port);
else
if (my_ip != NULL && ip->family != my_ip->family) {
i_warning("net_connect_ip(): ip->family != my_ip->family");
- my_ip = NULL;
+ my_ip = NULL;
}
/* create the socket */
i_zero(&so);
- so.sin.sin_family = ip->family;
+ so.sin.sin_family = ip->family;
fd = socket(ip->family, sock_type, 0);
if (fd == -1) {
if (ret < 0 && WSAGetLastError() != WSAEWOULDBLOCK)
#endif
{
- i_close_fd(&fd);
+ i_close_fd(&fd);
return -1;
}
/* create the socket */
i_zero(&so);
- so.sin.sin_family = ip->family;
+ so.sin.sin_family = ip->family;
fd = socket(ip->family, SOCK_STREAM, 0);
if (fd == -1) {
i_error("socket() failed: %m");
/* connect */
ret = connect(fd, &sa.sa, sizeof(sa));
if (ret < 0 && errno != EINPROGRESS) {
- i_close_fd(&fd);
+ i_close_fd(&fd);
return -1;
}
}
}
- /* error */
+ /* error */
i_close_fd(&fd);
return -1;
}
return 0;
if (errno == ECONNRESET || errno == ETIMEDOUT) {
- /* treat as disconnection */
+ /* treat as disconnection */
return -2;
}
}
struct addrinfo hints, *ai, *origai;
struct ip_addr ip;
int host_error;
- int count;
+ int count;
*ips = NULL;
- *ips_count = 0;
+ *ips_count = 0;
/* support [ipv6] style addresses here so they work globally */
if (addr[0] == '[' && net_addr2ip(addr, &ip) == 0) {
return host_error;
}
- /* get number of IPs */
- origai = ai;
+ /* get number of IPs */
+ origai = ai;
for (count = 0; ai != NULL; ai = ai->ai_next)
count++;
i_assert(count > 0);
- *ips_count = count;
- *ips = t_new(struct ip_addr, count);
+ *ips_count = count;
+ *ips = t_new(struct ip_addr, count);
- count = 0;
+ count = 0;
for (ai = origai; ai != NULL; ai = ai->ai_next, count++) {
so = (union sockaddr_union *) ai->ai_addr;