return;
}
- auth_requests = array_first_modifiable(&auth_failures_arr);
+ auth_requests = array_front_modifiable(&auth_failures_arr);
/* count the number of requests that we need to flush */
for (i = 0; i < count; i++) {
auth_request = auth_requests[aqueue_idx(auth_failures, i)];
array_append(&ips_array, ips, ips_count);
}
array_append_zero(&ips_array);
- set->proxy_self_ips = array_first(&ips_array);
+ set->proxy_self_ips = array_front(&ips_array);
return TRUE;
}
struct auth_worker_connection **connp, *conn;
while (array_count(&connections) > 0) {
- connp = array_first_modifiable(&connections);
+ connp = array_front_modifiable(&connections);
conn = *connp;
auth_worker_destroy(&conn, "Shutting down", FALSE);
}
if (count == 0)
return NULL;
- requests = array_first(&conn->request_array);
+ requests = array_front(&conn->request_array);
for (i = 0; i < count; i++) {
request = requests[aqueue_idx(conn->request_queue, i)];
if (request->msgid == msgid) {
if (field->ldap_attr_name[0] == '\0') {
str_truncate(tmp_str, 0);
if (var_expand_with_funcs(tmp_str, field->value, table,
- array_first(&var_funcs_table), &ctx, &error) <= 0) {
+ array_front(&var_funcs_table), &ctx, &error) <= 0) {
auth_request_log_error(auth_request,
AUTH_SUBSYS_DB,
"Failed to expand subquery %s: %s",
request->request.msgid =
ldap_search(conn->ld, named_res->dn, LDAP_SCOPE_BASE,
- NULL, array_first_modifiable(&ctx.attr_names), 0);
+ NULL, array_front_modifiable(&ctx.attr_names), 0);
if (request->request.msgid == -1) {
auth_request_log_error(auth_request, AUTH_SUBSYS_DB,
"ldap_search(dn=%s) failed: %s",
timeout_remove(&conn->to);
if (conn->pending_count != 0) {
- requests = array_first(&conn->request_array);
+ requests = array_front(&conn->request_array);
for (i = 0; i < conn->pending_count; i++) {
request = requests[aqueue_idx(conn->request_queue, i)];
}
}
array_append_zero(&ctx.attr_names);
- *attr_names_r = array_first_modifiable(&ctx.attr_names);
+ *attr_names_r = array_front_modifiable(&ctx.attr_names);
}
static const struct var_expand_table *
}
array_append_zero(&modules);
wanted_modules = array_count(&modules) == 1 ? NULL :
- array_first(&modules);
+ array_front(&modules);
if (is_master) {
/* master reads configuration only when reloading settings */
}
if (filter->service == NULL) {
array_append_zero(&service_names);
- output_r->specific_services = array_first(&service_names);
+ output_r->specific_services = array_front(&service_names);
}
array_sort(&matches, config_filter_parser_cmp);
array_append_zero(&matches);
- return array_first(&matches);
+ return array_front(&matches);
}
struct config_filter_parser *const *
}
array_sort(&filters, config_filter_parser_cmp_rev);
array_append_zero(&filters);
- return array_first(&filters);
+ return array_front(&filters);
}
struct config_filter_parser *const *
}
array_sort(&matches, config_filter_parser_cmp_rev);
array_append_zero(&matches);
- return array_first(&matches);
+ return array_front(&matches);
}
static bool
new_filter = config_filter_init(ctx->pool);
array_append_zero(&ctx->all_parsers);
- config_filter_add_all(new_filter, array_first(&ctx->all_parsers));
+ config_filter_add_all(new_filter, array_front(&ctx->all_parsers));
if (ret < 0)
;
for (i = 0; all_roots[i] != NULL; i++)
array_push_back(&new_roots, &all_roots[i]);
array_append_zero(&new_roots);
- all_roots = array_first(&new_roots);
+ all_roots = array_front(&new_roots);
roots_free_at_deinit = new_roots;
} else {
array_free(&new_roots);
}
array_append_zero(&module_names);
wanted_modules = array_count(&module_names) == 1 ? NULL :
- array_first(&module_names);
+ array_front(&module_names);
config_path = master_service_get_config_path(master_service);
/* use strcmp() instead of !=, because dovecot -n always gives us
dict_connection_ref(conn);
while (array_count(&conn->cmds) > 0) {
- first_cmdp = array_first(&conn->cmds);
+ first_cmdp = array_front(&conn->cmds);
cmd = *first_cmdp;
i_assert(cmd->async_reply_id == 0);
struct dict_connection_cmd *const *first_cmdp;
if (cmd->conn->minor_version < DICT_CLIENT_PROTOCOL_TIMINGS_MIN_VERSION) {
- first_cmdp = array_first(&cmd->conn->cmds);
+ first_cmdp = array_front(&cmd->conn->cmds);
if (*first_cmdp != cmd)
return;
}
conn->name);
hosts = mail_hosts_get(conn->dir->mail_hosts);
while (array_count(hosts) > 0) {
- hostp = array_first(hosts);
+ hostp = array_front(hosts);
director_remove_host(conn->dir, NULL, NULL, *hostp);
}
} else if (remote_ring_completed == 0 && conn->dir->ring_handshaked) {
string_t *str = t_str_new(128);
while (array_count(&dir->pending_requests) > 0) {
- requestp = array_first_modifiable(&dir->pending_requests);
+ requestp = array_front_modifiable(&dir->pending_requests);
request = *requestp;
if (request->create_time +
*_dir = NULL;
while (array_count(&dir->connections) > 0) {
- connp = array_first(&dir->connections);
+ connp = array_front(&dir->connections);
conn = *connp;
director_connection_deinit(&conn, "Shutting down");
}
timeout_remove(&dir->to_remove_dirs);
timeout_remove(&dir->to_callback);
while (array_count(&dir->dir_hosts) > 0) {
- hostp = array_first(&dir->dir_hosts);
+ hostp = array_front(&dir->dir_hosts);
host = *hostp;
director_host_free(&host);
}
}
array_append_zero(&tmp);
e_debug(e->event(), "Resolve success: %s",
- t_strarray_join(array_first(&tmp), ", "));
+ t_strarray_join(array_front(&tmp), ", "));
o_stream_nsend_str(client->output,
- t_strarray_join(array_first(&tmp), "\t"));
+ t_strarray_join(array_front(&tmp), "\t"));
o_stream_nsend_str(client->output, "\n");
}
} else if (strcmp(args[0], "NAME") == 0) {
}
i_assert(pargc == array_count(&opts)-1); /* opts is NULL-terminated */
- while((c = getopt_long(argc, (char*const*)argv, str_c(optbuf), array_first(&opts), &li)) > -1) {
+ while((c = getopt_long(argc, (char*const*)argv, str_c(optbuf), array_front(&opts), &li)) > -1) {
switch(c) {
case 0:
for(unsigned int i = 0; i < array_count(&pargv); i++) {
}
array_push_back(&cmd_args, &p);
array_append_zero(&cmd_args);
- *cmd_args_r = array_first(&cmd_args);
+ *cmd_args_r = array_front(&cmd_args);
}
static const char *const *
array_push_back(&cmd_args, &value);
}
array_append_zero(&cmd_args);
- return array_first(&cmd_args);
+ return array_front(&cmd_args);
}
static bool mirror_get_remote_cmd(struct dsync_cmd_context *ctx,
t_strsplit_spaces(doveadm_settings->dsync_hashed_headers, " ,");
if (array_count(&ctx->exclude_mailboxes) > 0) {
/* array is NULL-terminated in init() */
- set.exclude_mailboxes = array_first(&ctx->exclude_mailboxes);
+ set.exclude_mailboxes = array_front(&ctx->exclude_mailboxes);
}
doveadm_user_init_dsync(user);
if (count == 0)
return;
- keywords = array_first(&index->keywords);
+ keywords = array_front(&index->keywords);
for (i = 0; i < count; i++)
printf("%3u = %s\n", i, keywords[kw_indexes[i]]);
}
const struct kick_user *user;
if (array_count(&k_pid->users) == 1) {
- user = array_first(&k_pid->users);
+ user = array_front(&k_pid->users);
if (!user->kick_me)
return FALSE;
} else {
if (doveadm_mail_iter_init(&ctx->ctx, info, ctx->ctx.search_args,
ctx->wanted_fields,
- array_first(&ctx->header_fields),
+ array_front(&ctx->header_fields),
FALSE,
&iter) < 0)
return -1;
}
if (array_count(&keywords) > 0 || ctx->modify_type == MODIFY_REPLACE) {
array_append_zero(&keywords);
- ctx->keywords = array_first(&keywords);
+ ctx->keywords = array_front(&keywords);
}
_ctx->search_args = doveadm_mail_build_search_args(args+1);
if (array_count(&server->queue) > 0) {
struct server_connection *conn;
- char *const *usernamep = array_first(&server->queue);
+ char *const *usernamep = array_front(&server->queue);
char *username = *usernamep;
conn = doveadm_server_find_unused_conn(server);
while (array_count(&server->connections) > 0) {
struct server_connection *const *connp, *conn;
- connp = array_first(&server->connections);
+ connp = array_front(&server->connections);
conn = *connp;
server_connection_destroy(&conn);
}
array_append_array(&full_args, &pargv);
mctx->args = array_idx(&full_args, args_pos);
- mctx->full_args = array_first(&full_args);
+ mctx->full_args = array_front(&full_args);
doveadm_mail_cmd_exec(mctx, wildcard_user);
doveadm_mail_cmd_free(mctx);
iter->only_selectable = TRUE;
iter->iter_flags = iter_flags;
iter->iter = mailbox_list_iter_init_namespaces(user->namespaces,
- array_first(&iter->patterns),
+ array_front(&iter->patterns),
ns_mask, iter_flags);
return iter;
}
entry->value = value;
if (ctx.idx >= array_count(&ctx.headers)) {
- if (var_expand(ctx.buf, ctx.format, array_first(&ctx.headers), &error) <= 0) {
+ if (var_expand(ctx.buf, ctx.format, array_front(&ctx.headers), &error) <= 0) {
i_error("Failed to expand print format '%s': %s",
ctx.format, error);
}
if (array_count(&user->ips) == 0)
i_zero(ip_r);
else {
- const struct ip_addr *ip = array_first(&user->ips);
+ const struct ip_addr *ip = array_front(&user->ips);
*ip_r = *ip;
}
}
if (array_count(&local_sorted) == 0) {
/* local has no cached fields. set them to same as remote. */
array_append_zero(&remote_sorted);
- update->cache_updates = array_first(&remote_sorted);
+ update->cache_updates = array_front(&remote_sorted);
return;
}
i_assert(li == local_count && ri == remote_count);
if (array_count(&changes) > 0) {
array_append_zero(&changes);
- update->cache_updates = array_first(&changes);
+ update->cache_updates = array_front(&changes);
}
}
if (array_count(&pipe->item_queue) == 0)
return NULL;
- item = array_first_modifiable(&pipe->item_queue);
+ item = array_front_modifiable(&pipe->item_queue);
i_assert(item->type == type);
pipe->pop_item = *item;
array_pop_front(&pipe->item_queue);
if (array_count(&pipe->item_queue) == 0)
return FALSE;
- item = array_first(&pipe->item_queue);
+ item = array_front(&pipe->item_queue);
if (item->type != ITEM_END_OF_LIST)
return FALSE;
struct item *item;
if (array_count(&pipe->item_queue) > 0) {
- item = array_first_modifiable(&pipe->item_queue);
+ item = array_front_modifiable(&pipe->item_queue);
if (item->type == ITEM_MAIL &&
item->u.mail.input != NULL)
i_stream_unref(&item->u.mail.input);
array_count(&instances->seqs) == 0)
continue;
- uids = array_first(&instances->seqs);
+ uids = array_front(&instances->seqs);
seq = uids[0].seq1;
if (!instances->searched) {
instances->searched = TRUE;
&const_guid);
continue;
}
- uids = array_first(&instances->seqs);
+ uids = array_front(&instances->seqs);
seq = uids[0].seq1;
seq_range_array_add(&sarg->value.seqset, seq);
}
if (array_count(&add_keywords) > 0) {
array_append_zero(&add_keywords);
kw = mailbox_keywords_create_valid(mail->box,
- array_first(&add_keywords));
+ array_front(&add_keywords));
mail_update_keywords(mail, MODIFY_ADD, kw);
mailbox_keywords_unref(&kw);
}
if (array_count(&remove_keywords) > 0) {
array_append_zero(&remove_keywords);
kw = mailbox_keywords_create_valid(mail->box,
- array_first(&remove_keywords));
+ array_front(&remove_keywords));
mail_update_keywords(mail, MODIFY_REMOVE, kw);
mailbox_keywords_unref(&kw);
}
}
array_append_zero(&keywords);
- kw = mailbox_keywords_create_valid(mail->box, array_first(&keywords));
+ kw = mailbox_keywords_create_valid(mail->box, array_front(&keywords));
mail_update_keywords(mail, MODIFY_REPLACE, kw);
mailbox_keywords_unref(&kw);
return NULL;
array_append_zero(&keywords);
- return array_first(&keywords);
+ return array_front(&keywords);
}
static void
if (array_count(&access_apps) > 0) {
(void)array_append_space(&access_apps);
main_stdio_run(access_user,
- array_first(&access_apps));
+ array_front(&access_apps));
} else {
main_stdio_run(access_user, NULL);
}
array_push_back(&full_patterns, &pattern);
}
array_append_zero(&full_patterns); /* NULL-terminate */
- return array_first(&full_patterns);
+ return array_front(&full_patterns);
}
static void cmd_list_init(struct cmd_list_context *ctx,
}
array_append_zero(&patterns); /* NULL-terminate */
- patterns_strarr = array_first(&patterns);
+ patterns_strarr = array_front(&patterns);
if (!ctx->used_listext && !lsub && *patterns_strarr[0] == '\0') {
/* Only LIST ref "" gets us here */
cmd_list_ref_root(client, ref);
if (t1->timestamp > t2->timestamp)
return 1;
- m1 = array_first(&t1->msgs);
- m2 = array_first(&t2->msgs);
+ m1 = array_front(&t1->msgs);
+ m2 = array_front(&t2->msgs);
if (*m1 < *m2)
return -1;
if (*m1 > *m2)
}
}
array_append_zero(&feature_strings);
- return array_first(&feature_strings);
+ return array_front(&feature_strings);
}
struct imap_search_update *
*keywords_r = NULL;
else {
array_append_zero(&keywords); /* NULL-terminate */
- *keywords_r = array_first(&keywords);
+ *keywords_r = array_front(&keywords);
}
return TRUE;
}
&status);
keywords = count == 0 ? NULL :
- array_first(client->keywords.names);
+ array_front(client->keywords.names);
str = t_str_new(128);
str_append(str, "* FLAGS (");
imap_write_flags(str, status.flags, keywords);
}
array_append_zero(dest);
- return array_first(dest);
+ return array_front(dest);
}
void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str)
{
const struct imap_fetch_handler *handler, *first_handler;
- first_handler = array_first(&fetch_handlers);
+ first_handler = array_front(&fetch_handlers);
handler = imap_fetch_handler_lookup(name);
i_assert(handler != NULL);
array_delete(&fetch_handlers, handler - first_handler, 1);
unsigned int i, count;
seqs = array_get(qresync_args->qresync_sample_seqset, &count);
- uids = array_first(qresync_args->qresync_sample_uidset);
+ uids = array_front(qresync_args->qresync_sample_uidset);
i_assert(array_count(qresync_args->qresync_sample_uidset) == count);
i_assert(count > 0);
MAIL_FETCH_STREAM_BODY)) == 0)) {
array_append_zero(&ctx->all_headers);
- headers = array_first(&ctx->all_headers);
+ headers = array_front(&ctx->all_headers);
wanted_headers = mailbox_header_lookup_init(box, headers);
array_pop_back(&ctx->all_headers);
}
DLLIST_REMOVE(&conn->group->connections, conn);
while (array_count(&conn->cmds) > 0) {
- cmdp = array_first(&conn->cmds);
+ cmdp = array_front(&conn->cmds);
cmd = *cmdp;
ipc_connection_cmd_free(&cmd, error);
struct ipc_group *const *groupp, *group;
while (array_count(&ipc_groups) > 0) {
- groupp = array_first(&ipc_groups);
+ groupp = array_front(&ipc_groups);
group = *groupp;
while ((*groupp)->connections != NULL) {
}
}
array_append_zero(&new_args);
- return array_first(&new_args);
+ return array_front(&new_args);
}
static bool auth_lookup_reply_callback(const char *cmd, const char *const *args,
array_append_zero(&exp);
- if (var_expand(query_r, template, array_first(&exp), &error) <= 0) {
+ if (var_expand(query_r, template, array_front(&exp), &error) <= 0) {
*error_r = t_strdup_printf("Failed to expand %s: %s", template, error);
return FALSE;
}
if (line[0] != '*' || str_to_uint(line+1, &num_replies) < 0)
break;
- reply = array_first_modifiable(&dict->replies);
+ reply = array_front_modifiable(&dict->replies);
i_assert(reply->reply_count > 0);
if (reply->reply_count != num_replies) {
*error_r = t_strdup_printf(
if (*line != '+' && *line != ':')
break;
/* success, just ignore the actual reply */
- reply = array_first_modifiable(&dict->replies);
+ reply = array_front_modifiable(&dict->replies);
i_assert(reply->reply_count > 0);
if (--reply->reply_count == 0) {
const struct dict_commit_result result = {
array_append_zero(&np->utf16_token);
array_pop_back(&np->utf16_token);
array_clear(&np->trans_token);
- if (fts_icu_translate(&np->trans_token, array_first(&np->utf16_token),
+ if (fts_icu_translate(&np->trans_token, array_front(&np->utf16_token),
array_count(&np->utf16_token),
np->transliterator, error_r) < 0)
return -1;
if (array_count(&np->trans_token) == 0)
return 0;
- fts_icu_utf16_to_utf8(np->utf8_token, array_first(&np->trans_token),
+ fts_icu_utf16_to_utf8(np->utf8_token, array_front(&np->trans_token),
array_count(&np->trans_token));
fts_filter_truncate_token(np->utf8_token, np->filter.max_length);
*token = str_c(np->utf8_token);
t_array_init(&id_utf16, strlen(id));
fts_icu_utf8_to_utf16(&id_utf16, id);
- *transliterator_r = utrans_openU(array_first(&id_utf16),
+ *transliterator_r = utrans_openU(array_front(&id_utf16),
array_count(&id_utf16),
UTRANS_FORWARD, NULL, 0, &perr, &err);
if (U_FAILURE(err)) {
{
const struct fts_language *const *langp;
- langp = array_first(&list->languages);
+ langp = array_front(&list->languages);
return *langp;
}
/* if there's only a single wanted language, return it always. */
if (array_count(&list->languages) == 1) {
const struct fts_language *const *langp =
- array_first(&list->languages);
+ array_front(&list->languages);
*lang_r = *langp;
return FTS_LANGUAGE_RESULT_OK;
}
t_array_init(&id_utf16, 8);
fts_icu_utf8_to_utf16(&id_utf16, id);
- translit = utrans_openU(array_first(&id_utf16),
+ translit = utrans_openU(array_front(&id_utf16),
array_count(&id_utf16),
UTRANS_FORWARD, NULL, 0, &perr, &err);
test_assert(!U_FAILURE(err));
fts_icu_utf8_to_utf16(&src_utf16, src_utf8);
t_array_init(&dest, i);
test_assert(buffer_get_writable_size(dest.arr.buffer) == i*2);
- test_assert(fts_icu_translate(&dest, array_first(&src_utf16),
+ test_assert(fts_icu_translate(&dest, array_front(&src_utf16),
array_count(&src_utf16),
translit, &error) == 0);
}
string_t *str = t_str_new(64);
if (array_count(&conn->request_wait_list) > 0) {
- requestp = array_first(&conn->request_wait_list);
+ requestp = array_front(&conn->request_wait_list);
str_append(str, "Request ");
http_client_request_append_stats_text(*requestp, str);
i_assert(array_is_created(&conn->request_wait_list));
i_assert(array_count(&conn->request_wait_list) > 0);
- requestp = array_first(&conn->request_wait_list);
+ requestp = array_front(&conn->request_wait_list);
timeout_msecs = (*requestp)->attempt_timeout_msecs;
if (timeout_msecs == 0)
&& array_is_created(&coding->parameters)
&& array_count(&coding->parameters) > 0) {
const struct http_transfer_param *param =
- array_first(&coding->parameters);
+ array_front(&coding->parameters);
parser->error_code = HTTP_MESSAGE_PARSE_ERROR_BAD_MESSAGE;
parser->error = t_strdup_printf(
/* FIXME: stupid algorithm */
if (array_count(&client->conns) == 0)
return imapc_client_add_connection(client)->conn;
- connp = array_first(&client->conns);
+ connp = array_front(&client->conns);
return (*connp)->conn;
}
cmd->sent = TRUE;
/* everything sent. move command to wait list. */
- cmdp = array_first(&conn->cmd_send_queue);
+ cmdp = array_front(&conn->cmd_send_queue);
i_assert(*cmdp == cmd);
array_pop_front(&conn->cmd_send_queue);
array_push_back(&conn->cmd_wait_list, &cmd);
if (!array_is_created(&cmd->streams) || array_count(&cmd->streams) == 0)
return NULL;
- stream = array_first_modifiable(&cmd->streams);
+ stream = array_front_modifiable(&cmd->streams);
if (stream->pos != cmd->send_pos)
return NULL;
return stream;
return FALSE;
}
- first = array_first(&msgmap->uids);
+ first = array_front(&msgmap->uids);
*rseq_r = (p - first) + 1;
return TRUE;
}
return -1;
array_append_zero(&fields);
- msgpart->headers = array_first(&fields);
+ msgpart->headers = array_front(&fields);
return 0;
}
array_push_back(&patterns, &p->pattern);
}
array_append_zero(&patterns);
- return imap_match_init_multiple_real(pool, array_first(&patterns),
+ return imap_match_init_multiple_real(pool, array_front(&patterns),
inboxcase, glob->sep);
}
array_count(parser->cur_list) != 1)
return FALSE;
- arg = array_first(&parser->root_list);
+ arg = array_front(&parser->root_list);
if (arg->type != IMAP_ARG_ATOM)
return FALSE;
if (parser->cur_list != &parser->root_list)
return FALSE;
- arg = array_last(&parser->root_list);
+ arg = array_back(&parser->root_list);
if (arg->type != IMAP_ARG_ATOM)
return FALSE;
/* give new names to invalid keywords */
changed_count = 0;
- name_array = array_first_modifiable(&names);
+ name_array = array_front_modifiable(&names);
for (i = j = 0; i < keywords_count; i++) {
while (name_array[i][0] == '\0') {
name = t_strdup_printf("unknown-%d", j++);
ssize_t diff = (ssize_t)new_padded_hdr_size -
(ssize_t)old_padded_hdr_size;
- ext = array_first_modifiable(&map->extensions);
+ ext = array_front_modifiable(&map->extensions);
for (i = ext_map_idx + 1; i < count; i++) {
ext[i].ext_offset += diff;
ext[i].hdr_offset += diff;
}
keyword_updates = keyword_count == 0 ? NULL :
- array_first(&sync_trans->keyword_updates);
+ array_front(&sync_trans->keyword_updates);
for (i = 0; i < keyword_count; i++) {
if (array_is_created(&keyword_updates[i].add_seq)) {
synclist = array_append_space(&ctx->sync_list);
int i, days;
hdr = *mail_index_get_header(t->view);
- rec = array_first(&t->appends);
+ rec = array_front(&t->appends);
stamp = time_to_local_day_start(day_stamp);
if ((time_t)hdr.day_stamp >= stamp)
kw_idx = array_get(&ctx->lost_new_kw, &count);
if (count == 0)
return 0;
- kw_names = array_first(&ctx->view->index->keywords);
+ kw_names = array_front(&ctx->view->index->keywords);
i_zero(&thdr);
thdr.type = MAIL_TRANSACTION_KEYWORD_UPDATE | MAIL_TRANSACTION_EXTERNAL;
We're mapping the files in reverse order so that _log_file_map()
can verify that prev_file_offset matches how far it actually managed
to sync the file. */
- files = array_first(&view->file_refs);
+ files = array_front(&view->file_refs);
for (i = array_count(&view->file_refs); i > 0; i--) {
file = files[i-1];
start_offset = file->hdr.file_seq == min_file_seq ?
later on. */
i_assert(array_count(&changes.saved_uids) == 1);
const struct seq_range *range =
- array_first(&changes.saved_uids);
+ array_front(&changes.saved_uids);
i_assert(range->seq1 == range->seq2);
ctx->dest_mail = mail_deliver_open_mail(box, range->seq1,
MAIL_FETCH_STREAM_BODY | MAIL_FETCH_GUID, &t);
if (array_count(&changes_r->saved_uids) > 0) {
const struct seq_range *range =
- array_first(&changes_r->saved_uids);
+ array_front(&changes_r->saved_uids);
mail_deliver_cache_update_post_commit(box, range->seq1);
}
ber_free(bptr, 0);
array_append_zero(&attr_names);
- obj->attr_names = array_first(&attr_names);
+ obj->attr_names = array_front(&attr_names);
return 0;
}
const struct ldap_attribute *attr;
array_foreach(&entry->attributes, attr) {
if (strcasecmp(attr->name, attribute) == 0) {
- return array_first(&attr->values);
+ return array_front(&attr->values);
}
}
return NULL;
array_push_back(&arr, &tmp);
}
array_append_zero(&arr);
- req->input.search.attributes = array_first_modifiable(&arr);
+ req->input.search.attributes = array_front_modifiable(&arr);
}
req->send_request_cb = ldap_search_send;
}
array_append_zero(&conn->streams);
- inputs = array_first_modifiable(&conn->streams);
+ inputs = array_front_modifiable(&conn->streams);
input = i_stream_create_concat(inputs);
istream_attachment_connector_free(conn);
if (array_count(&langs) > 0) {
array_append_zero(&langs);
data->content_language =
- p_strarray_dup(pool, array_first(&langs));
+ p_strarray_dup(pool, array_front(&langs));
}
}
if (array_count(&rfc2231_params_arr) == 0) {
/* No RFC 2231 parameters */
array_append_zero(&result); /* NULL-terminate */
- *result_r = array_first(&result);
+ *result_r = array_front(&result);
return broken ? -1 : 0;
}
}
}
array_append_zero(&result); /* NULL-terminate */
- *result_r = array_first(&result);
+ *result_r = array_front(&result);
return broken ? -1 : 0;
}
i_assert(success);
- a = array_last_modifiable(&attachments);
+ a = array_back_modifiable(&attachments);
a->decoded_size = output->offset - a->buffer_offset;
if (o_stream_finish(output) < 0)
*_query = NULL;
count = aqueue_count(client->queries);
- queries = array_first(&client->queries_arr);
+ queries = array_front(&client->queries_arr);
for (i = 0; i < count; i++) {
if (queries[aqueue_idx(client->queries, i)] == query) {
query->callback = NULL;
if (array_is_created(&categories)) {
array_append_zero(&categories);
- query_r->categories = array_first(&categories);
+ query_r->categories = array_front(&categories);
}
if (array_is_created(&fields)) {
array_append_zero(&fields);
- query_r->fields = array_first(&fields);
+ query_r->fields = array_front(&fields);
}
return 0;
}
}
if (input->service == NULL) {
array_append_zero(&services);
- output_r->specific_services = array_first(&services);
+ output_r->specific_services = array_front(&services);
}
} T_END;
return 0;
}
array_append_zero(&filters_tmp);
- *filters = array_first(&filters_tmp);
+ *filters = array_front(&filters_tmp);
return 0;
}
}
parser = settings_parser_init_list(service->set_pool,
- array_first(&all_roots), array_count(&all_roots),
+ array_front(&all_roots), array_count(&all_roots),
SETTINGS_PARSER_FLAG_IGNORE_UNKNOWN_KEYS);
if (fd != -1) {
}
array_append_zero(&keys);
- value = t_strarray_join(array_first(&keys), " ");
+ value = t_strarray_join(array_front(&keys), " ");
env_put(t_strconcat(DOVECOT_PRESERVE_ENVS_ENV"=", value, NULL));
}
/* Execute */
- args = array_first(&exec_args);
+ args = array_front(&exec_args);
execvp_const(args[0], args);
}
i_assert(dest_count % 2 == 0);
for (i = 0; i < count; i += 2) {
if (dest_count > 0) {
- dest_strings = array_first(dest_arr);
+ dest_strings = array_front(dest_arr);
for (j = 0; j < dest_count; j += 2) {
if (strcmp(strings[i], dest_strings[j]) == 0)
break;
}
new_defines = p_new(pool, struct setting_define,
array_count(&defines) + 1);
- memcpy(new_defines, array_first(&defines),
+ memcpy(new_defines, array_front(&defines),
sizeof(*parent->defines) * array_count(&defines));
parent->defines = new_defines;
parent->dynamic_parsers =
p_new(pool, struct dynamic_settings_parser,
array_count(&dynamic_parsers) + 1);
- memcpy(parent->dynamic_parsers, array_first(&dynamic_parsers),
+ memcpy(parent->dynamic_parsers, array_front(&dynamic_parsers),
sizeof(*parent->dynamic_parsers) *
array_count(&dynamic_parsers));
parent->struct_size = new_struct_size;
parser->state.state = SMTP_REPLY_PARSE_STATE_INIT;
parser->state.reply->text_lines =
- array_first(&parser->state.reply_lines);
+ array_front(&parser->state.reply_lines);
*reply_r = parser->state.reply;
return 1;
}
parser->state.state = SMTP_REPLY_PARSE_STATE_INIT;
parser->state.reply->text_lines =
- array_first(&parser->state.reply_lines);
+ array_front(&parser->state.reply_lines);
*reply_r = parser->state.reply;
return 1;
}
/* [SP Mail-parameters] */
if (array_is_created(&conn->mail_param_extensions))
- param_extensions = array_first(&conn->mail_param_extensions);
+ param_extensions = array_front(&conn->mail_param_extensions);
if (smtp_params_mail_parse(cmd->pool, params, caps, param_extensions,
NULL, &mail_data->params, &pperror,
&error) < 0) {
/* [SP Rcpt-parameters] */
if (array_is_created(&conn->rcpt_param_extensions))
- param_extensions = array_first(&conn->rcpt_param_extensions);
+ param_extensions = array_front(&conn->rcpt_param_extensions);
if (smtp_params_rcpt_parse(rcpt->pool, params, caps, param_extensions,
&rcpt->params, &pperror, &error) < 0) {
switch (pperror) {
conn->stats.reply_count++;
i_assert(array_is_created(&cmd->replies));
- reply = array_first_modifiable(&cmd->replies);
+ reply = array_front_modifiable(&cmd->replies);
i_assert(reply->content != NULL);
if (reply->content->status == 221 || reply->content->status == 421) {
if (array_count(&trans->rcpt_to) == 1) {
struct smtp_server_recipient *const *rcpts =
- array_first(&trans->rcpt_to);
+ array_front(&trans->rcpt_to);
rcpt_to = smtp_address_encode(rcpts[0]->path);
}
restrict_access_init(&pc_set.restrict_set);
pc = program_client_local_create
- (sendmail_bin, array_first(&args), &pc_set);
+ (sendmail_bin, array_front(&args), &pc_set);
program_client_set_input(pc, subm->input);
i_stream_unref(&subm->input);
param = p_strdup_until(parser->pool, pbegin, parser->cur);
array_push_back(¶ms, ¶m);
array_append_zero(¶ms);
- *params_r = array_first(¶ms);
+ *params_r = array_front(¶ms);
}
return 1;
}
array_clear(&db->pending_prepares);
while (array_count(&db->results) > 0) {
- resultp = array_first(&db->results);
+ resultp = array_front(&db->results);
if ((*resultp)->error == NULL)
(*resultp)->error = i_strdup(error);
result_finish(*resultp);
{
struct cassandra_result *result = (struct cassandra_result *)_result;
- return array_first(&result->fields);
+ return array_front(&result->fields);
}
static const char *driver_cassandra_result_get_error(struct sql_result *_result)
/* build a new connect string without our settings or hosts */
array_append_zero(&connect_args);
- connect_string = t_strarray_join(array_first(&connect_args), " ");
+ connect_string = t_strarray_join(array_front(&connect_args), " ");
if (array_count(&hostnames) == 0) {
/* no hosts specified. create a default one. */
{
struct test_sql_db *db = (struct test_sql_db*)_db;
struct test_driver_result *result =
- array_first_modifiable(&db->expected);
+ array_front_modifiable(&db->expected);
i_assert(result->cur < result->nqueries);
/* i_debug("DUMMY EXECUTE: %s", query);
{
struct test_sql_db *db = (struct test_sql_db*)_db;
struct test_driver_result *result =
- array_first_modifiable(&db->expected);
+ array_front_modifiable(&db->expected);
struct test_sql_result *res = i_new(struct test_sql_result, 1);
driver_test_exec(_db, query);
{
struct test_sql_db *db= (struct test_sql_db*)ctx->db;
struct test_driver_result *result =
- array_first_modifiable(&db->expected);
+ array_front_modifiable(&db->expected);
driver_test_exec(ctx->db, query);
if (affected_rows != NULL)
hdr = mail_index_get_header(ctx->atomic->sync_view);
t_array_init(&uids, 1);
mail_index_append_finish_uids(ctx->trans, hdr->next_uid, &uids);
- range = array_first(&uids);
+ range = array_front(&uids);
i_assert(range[0].seq2 - range[0].seq1 + 1 == count);
if (hdr->uid_validity == 0) {
}
if (array_count(&ctx->primary_file_ids) > 0) {
const struct seq_range *range =
- array_first(&ctx->primary_file_ids);
+ array_front(&ctx->primary_file_ids);
ctx->lowest_primary_file_id = range[0].seq1;
}
if (errno != 0) {
dbox_save_end(&ctx->ctx);
- mail = array_last_modifiable(&ctx->mails);
+ mail = array_back_modifiable(&ctx->mails);
if (!ctx->ctx.failed) T_BEGIN {
if (mdbox_save_mail_write_metadata(ctx, mail) < 0)
ctx->ctx.failed = TRUE;
unsigned int highest_pop3_uidl_idx;
uint32_t uid;
- mails = array_first(&ctx->mails);
+ mails = array_front(&ctx->mails);
highest_pop3_uidl_idx =
ctx->ctx.highest_pop3_uidl_seq - mails[0].seq;
i_assert(mails[highest_pop3_uidl_idx].seq == ctx->ctx.highest_pop3_uidl_seq);
}
dbox_save_end(&ctx->ctx);
- files = array_last_modifiable(&ctx->files);
+ files = array_back_modifiable(&ctx->files);
if (!ctx->ctx.failed) T_BEGIN {
if (dbox_save_mail_write_metadata(&ctx->ctx, *files) < 0)
ctx->ctx.failed = TRUE;
}
}
array_append_zero(&headers);
- return array_first(&headers);
+ return array_front(&headers);
}
static bool
return;
array_append_zero(&hdr_arr);
- if (headers_have_subset(array_first(&hdr_arr), mail->fetching_headers))
+ if (headers_have_subset(array_front(&hdr_arr), mail->fetching_headers))
mail->header_list_fetched = TRUE;
if (args->type == IMAP_ARG_LITERAL_SIZE) {
}
headers_ctx = mailbox_header_lookup_init(mail->imail.mail.mail.box,
- array_first(&hdr_arr));
+ array_front(&hdr_arr));
index_mail_parse_header_init(&mail->imail, headers_ctx);
parser = message_parse_header_init(input, NULL, hdr_parser_flags);
array_append_zero(&keywords);
kw = mail_index_keywords_create(mbox->box.index,
- array_first(&keywords));
+ array_front(&keywords));
if (!keywords_are_equal(kw, &old_kws)) {
mail_index_update_keywords(mbox->delayed_sync_trans,
lseq, MODIFY_REPLACE, kw);
}
array_append_zero(&header_values);
- return array_first(&header_values);
+ return array_front(&header_values);
}
static int
}
array_append_zero(&header_values);
- *value_r = array_first(&header_values);
+ *value_r = array_front(&header_values);
return 0;
}
unsigned int i, count, names_count;
if (array_is_created(&data->keywords))
- return array_first(&data->keywords);
+ return array_front(&data->keywords);
(void)index_mail_get_keyword_indexes(_mail);
/* end with NULL */
array_append_zero(&data->keywords);
- return array_first(&data->keywords);
+ return array_front(&data->keywords);
}
const ARRAY_TYPE(keyword_indexes) *
array_append_zero(&names);
new_wanted_headers =
mailbox_header_lookup_init(_mail->box,
- array_first(&names));
+ array_front(&names));
if (data->wanted_headers != NULL)
mailbox_header_lookup_unref(&data->wanted_headers);
data->wanted_headers = new_wanted_headers;
if (part->parent == NULL)
break;
array_pop_back(&mpctx->stack);
- level = array_last_modifiable(&mpctx->stack);
+ level = array_back_modifiable(&mpctx->stack);
part = part->parent;
}
level->index++;
if (array_count(&headers) > 0) {
array_append_zero(&headers);
*headers_ctx_r = mailbox_header_lookup_init(box,
- array_first(&headers));
+ array_front(&headers));
}
}
if (!index_sort_list_next(_ctx->sort_program, &seq))
return FALSE;
- mailp = array_first(&ctx->mails);
+ mailp = array_front(&ctx->mails);
mail_set_seq(*mailp, seq);
index_mail_update_access_parts_pre(*mailp);
index_mail_update_access_parts_post(*mailp);
}
if (array_count(&new_fields) > 0) {
mail_cache_register_fields(box->cache,
- array_first_modifiable(&new_fields),
+ array_front_modifiable(&new_fields),
array_count(&new_fields));
}
}
const struct mail_index_sync_rec *syncs;
unsigned int i;
- syncs = array_first(&ctx->syncs);
+ syncs = array_front(&ctx->syncs);
for (i = 0; i < count; i++) {
if (syncs[i].type == MAIL_INDEX_SYNC_TYPE_EXPUNGE) {
memcpy(expunged_guid_128_r, syncs[i].guid_128,
/* find the oldest child */
thread_sort_children(ctx, roots[i].node.idx,
&sorted_children);
- children = array_first(&sorted_children);
+ children = array_front(&sorted_children);
idx = children[0].idx;
} else {
/* dummy without children */
} while (root->parent_root_idx1 != 0);
i_assert(!root->ignore);
- shadows = array_first_modifiable(&ctx->shadow_nodes);
+ shadows = array_front_modifiable(&ctx->shadow_nodes);
if (cur->dummy) {
/* If both messages are dummies, append the current
message's children to the children of the message in
if (roots[i].parent_root_idx1 != 0 && !roots[i].ignore) {
mail_thread_root_thread_merge(ctx, &roots[i]);
/* more roots may have been added */
- roots = array_first_modifiable(&ctx->roots);
+ roots = array_front_modifiable(&ctx->roots);
changed = TRUE;
}
}
unsigned int i, count, child_count;
i_array_init(&sorted_children, 64);
- shadows = array_first(&ctx->shadow_nodes);
+ shadows = array_front(&ctx->shadow_nodes);
roots = array_get_modifiable(&ctx->roots, &count);
for (i = 0; i < count; i++) {
if (roots[i].ignore)
roots = array_get_modifiable(&ctx->roots, &root_count);
/* drop childless dummy nodes */
- shadows = array_first(&ctx->shadow_nodes);
+ shadows = array_front(&ctx->shadow_nodes);
for (idx = 1; idx < root_count; idx++) {
if (roots[idx].dummy &&
shadows[roots[idx].node.idx].first_child_idx == 0)
i_assert(reply != NULL);
i_assert(array_count(&client->commands) > 0);
- cmd = array_first_modifiable(&client->commands);
+ cmd = array_front_modifiable(&client->commands);
if (cmd->input != NULL && state == POP3C_COMMAND_STATE_OK &&
!cmd->reading_dot) {
/* read the full input into seekable-istream before calling
/* make msg_uidls non-NULL */
array_append_zero(&uidls);
}
- mbox->msg_uidls = array_first(&uidls);
+ mbox->msg_uidls = array_front(&uidls);
mbox->msg_count = seq;
return 0;
}
}
}
array_append_zero(&valid_patterns); /* NULL-terminate */
- ctx->valid_patterns = array_first(&valid_patterns);
+ ctx->valid_patterns = array_front(&valid_patterns);
return array_count(&valid_patterns) > 1;
}
return;
}
uids = t_new(struct seq_range, count);
- memcpy(uids, array_first(&arg->value.seqset), sizeof(*uids) * count);
+ memcpy(uids, array_front(&arg->value.seqset), sizeof(*uids) * count);
/* put them back to the range as sequences */
array_clear(&arg->value.seqset);
struct mail_storage_module_hooks *hook;
mail_storage_hooks_add(module, hooks);
- hook = array_last_modifiable(&module_hooks);
+ hook = array_back_modifiable(&module_hooks);
hook->forced = TRUE;
}
}
array_append_zero(&content_types);
- set->parsed_mail_attachment_content_type_filter = array_first(&content_types);
+ set->parsed_mail_attachment_content_type_filter = array_front(&content_types);
}
return TRUE;
if (ret != 0)
return ret > 0;
- range = array_first(uids_filter);
+ range = array_front(uids_filter);
min_uid = range->seq1;
/* first get UIDs of all actual expunges */
return CONST_PTR_OFFSET(array->buffer->data, idx * array->element_size);
}
-#define array_first(array) array_idx(array, 0)
-#define array_first_modifiable(array) array_idx_modifiable(array, 0)
-#define array_last(array) array_idx(array, array_count(array)-1)
-#define array_last_modifiable(array) array_idx_modifiable(array, array_count(array)-1)
+#define array_front(array) array_idx(array, 0)
+#define array_front_modifiable(array) array_idx_modifiable(array, 0)
+#define array_back(array) array_idx(array, array_count(array)-1)
+#define array_back_modifiable(array) array_idx_modifiable(array, array_count(array)-1)
#define array_pop_back(array) array_delete(array, array_count(array)-1, 1);
#define array_push_back(array, item) array_append(array, (item), 1)
#define array_pop_front(array) array_delete(array, 0, 1)
&event_filter_log_type_names[i]);
}
array_append_zero(&categories);
- query.categories = array_first(&categories);
+ query.categories = array_front(&categories);
}
if (int_query->fields_count > 0) {
ARRAY(struct event_filter_field) fields;
field->value = p_strdup(dest->pool, int_query->fields[i].value.str);
}
array_append_zero(&fields);
- query.fields = array_first(&fields);
+ query.fields = array_front(&fields);
}
event_filter_add(dest, &query);
/* finish the query */
if (array_count(&categories) > 0) {
array_append_zero(&categories);
- query.categories = array_first(&categories);
+ query.categories = array_front(&categories);
}
if (array_count(&fields) > 0) {
array_append_zero(&fields);
- query.fields = array_first(&fields);
+ query.fields = array_front(&fields);
}
event_filter_add(filter, &query);
if (array_count(&pq->items) == 0)
return NULL;
- items = array_first(&pq->items);
+ items = array_front(&pq->items);
return items[0];
}
if (array_count(&pq->items) == 0)
return NULL;
- return array_first(&pq->items);
+ return array_front(&pq->items);
}
{
if (array_count(arr) == 0)
return "";
- return p_strarray_join_n(pool, array_first(arr), array_count(arr),
+ return p_strarray_join_n(pool, array_front(arr), array_count(arr),
separator);
}
array_append(&intarr, input, i);
array_reverse(&intarr);
- output = i == 0 ? NULL : array_first(&intarr);
+ output = i == 0 ? NULL : array_front(&intarr);
for (j = 0; j < i; j++)
test_assert(input[i-j-1] == output[j]);
}
t_array_init(&ad, 3);
/* allocation big enough, but memory not initialised */
test_expect_fatal_string("(array_idx_i): assertion failed: (idx < array->buffer->used / array->element_size)");
- useless_ptr = array_first(&ad);
+ useless_ptr = array_front(&ad);
return FATAL_TEST_FAILURE;
}
test_assert(array_count(&range) == 3);
seq_range_array_remove_nth(&range, 0, 2);
- r = array_first(&range); test_assert(r->seq1 == 3 && r->seq2 == 5);
+ r = array_front(&range); test_assert(r->seq1 == 3 && r->seq2 == 5);
seq_range_array_remove_nth(&range, 1, 4);
- r = array_first(&range); test_assert(r->seq1 == 3 && r->seq2 == 3);
+ r = array_front(&range); test_assert(r->seq1 == 3 && r->seq2 == 3);
r = array_idx(&range, 1); test_assert(r->seq1 == 11 && r->seq2 == 20);
seq_range_array_remove_nth(&range, 5, (uint32_t)-1);
}
array_append_zero(¶ms);
- parms = array_first(¶ms);
+ parms = array_front(¶ms);
t_array_init(¶ms, 6);
for(;*parms != NULL; parms++) {
i_assert(array_count(¶ms) == 5);
/* execute comparison */
- const char *const *args = array_first(¶ms);
+ const char *const *args = array_front(¶ms);
if (var_expand_if_comp(args[0], args[1], args[2], &result, error_r)<0)
return -1;
*result_r = result ? args[3] : args[4];
entry->long_key = p_strdup(pool, b[i].long_key);
}
array_append_zero(&table);
- return array_first_modifiable(&table);
+ return array_front_modifiable(&table);
}
alt = p_new(client->pool, const char *,
array_count(&alt_usernames) + 1);
- memcpy(alt, array_first(&alt_usernames),
+ memcpy(alt, array_front(&alt_usernames),
sizeof(*alt) * array_count(&alt_usernames));
client->alt_usernames = alt;
}
if (notify->io_write == NULL)
return;
- processes = array_first_modifiable(¬ify->processes);
+ processes = array_front_modifiable(¬ify->processes);
count = aqueue_count(notify->process_queue);
for (i = 0; i < count; i++) {
process = processes[aqueue_idx(notify->process_queue, i)];
struct service_process *const *processes, *process;
while (aqueue_count(notify->process_queue) > 0) {
- processes = array_first_modifiable(¬ify->processes);
+ processes = array_front_modifiable(¬ify->processes);
process = processes[aqueue_idx(notify->process_queue, 0)];
if (notify->write_callback(notify->fd, process) < 0) {
}
if (array_count(&dest_rights) > 0) {
array_append_zero(&dest_rights);
- update->rights.rights = array_first(&dest_rights);
+ update->rights.rights = array_front(&dest_rights);
} else if (update->modify_mode == ACL_MODIFY_MODE_REPLACE) {
update->modify_mode = ACL_MODIFY_MODE_CLEAR;
}
if (array_count(&dest_neg_rights) > 0) {
array_append_zero(&dest_neg_rights);
- update->rights.neg_rights = array_first(&dest_neg_rights);
+ update->rights.neg_rights = array_front(&dest_neg_rights);
} else if (update->neg_modify_mode == ACL_MODIFY_MODE_REPLACE) {
update->neg_modify_mode = ACL_MODIFY_MODE_CLEAR;
}
}
new_rights = &null;
modify_rights = array_count(&rights) == 0 ? NULL :
- array_first(&rights);
+ array_front(&rights);
acl_right_names_merge(pool, &new_rights, modify_rights, TRUE);
break;
case ACL_MODIFY_MODE_ADD:
unsigned int *count_r)
{
*count_r = array_count(&cache->right_idx_name_map);
- return array_first(&cache->right_idx_name_map);
+ return array_front(&cache->right_idx_name_map);
}
static void
random_fill(&auser->token, sizeof(auser->token));
/* try change hat */
- if (aa_change_hatv(array_first_modifiable(&hats), auser->token) < 0) {
+ if (aa_change_hatv(array_front_modifiable(&hats), auser->token) < 0) {
i_fatal("aa_change_hatv(%s) failed: %m",
t_array_const_string_join(&hats, ","));
}
str = doveadm_plugin_getenv(set_name);
}
array_append_zero(&patterns);
- return array_first(&patterns);
+ return array_front(&patterns);
}
static bool
str = mail_user_set_plugin_getenv(user->set, set_name);
}
array_append_zero(&patterns);
- return array_first(&patterns);
+ return array_front(&patterns);
}
static void expire_mail_user_created(struct mail_user *user)
}
array_append_zero(&box_results);
- result->box_results = array_first_modifiable(&box_results);
+ result->box_results = array_front_modifiable(&box_results);
return 0;
}
fts_result->scores_sorted = TRUE;
}
array_append_zero(&fts_results);
- result->box_results = array_first_modifiable(&fts_results);
+ result->box_results = array_front_modifiable(&fts_results);
hash_table_destroy(&mailboxes);
return 0;
}
fts_result->scores_sorted = TRUE;
}
array_append_zero(&fts_results);
- result->box_results = array_first_modifiable(&fts_results);
+ result->box_results = array_front_modifiable(&fts_results);
hash_table_destroy(&mailboxes);
return 0;
}
hash_table_destroy(&solr_lookup_context.mailboxes);
array_append_zero(&solr_lookup_context.results);
- *box_results_r = array_first_modifiable(&solr_lookup_context.results);
+ *box_results_r = array_front_modifiable(&solr_lookup_context.results);
return parse_ret;
}
/* write end indexes */
o_stream_nsend(output, uidlist->cur_block_end_indexes,
old_block_count * sizeof(uint32_t));
- o_stream_nsend(output, array_first(block_end_indexes),
+ o_stream_nsend(output, array_front(block_end_indexes),
new_block_count * sizeof(uint32_t));
/* write offsets */
o_stream_nsend(output, uidlist->cur_block_offsets,
old_block_count * sizeof(uint32_t));
- o_stream_nsend(output, array_first(block_offsets),
+ o_stream_nsend(output, array_front(block_offsets),
new_block_count * sizeof(uint32_t));
(void)o_stream_flush(output);
int ret;
T_BEGIN {
- ret = uidlist_write_array(ctx->output, array_first(uids),
+ ret = uidlist_write_array(ctx->output, array_front(uids),
array_count(uids), 0, 0, FALSE,
&ctx->list_sizes[ctx->list_idx]);
} T_END;
memcpy(rec->guid, mailbox->guid, sizeof(rec->guid));
/* uint32_t expunge_uid_ranges[]; */
- buffer_append(output, array_first(&mailbox->uids),
+ buffer_append(output, array_front(&mailbox->uids),
array_count(&mailbox->uids) *
sizeof(struct seq_range));
/* uint32_t expunge_count; */
mail_search_args_reset(args, TRUE);
if (fts_backend_lookup_multi(backend,
- array_first(&tmp_mailboxes),
+ array_front(&tmp_mailboxes),
args, flags, &result) < 0)
return -1;
str = mail_user_plugin_getenv(user, set_name);
}
array_append_zero(&patterns);
- return array_first(&patterns);
+ return array_front(&patterns);
}
static bool fts_autoindex_exclude_match(struct mailbox *box)
array_push_back(&arr, &value);
}
array_append_zero(&arr);
- return array_first(&arr);
+ return array_front(&arr);
}
static int
}
}
array_append_zero(&rights);
- *rights_r = array_first(&rights);
+ *rights_r = array_front(&rights);
return 0;
}
return;
}
array_append_zero(&new_rights);
- update->rights.rights = array_first(&new_rights);
+ update->rights.rights = array_front(&new_rights);
}
static int
test_assert(strcmp(binary_to_hex(key_id->data, key_id->used), pubid1) == 0);
const struct mail_crypt_global_private_key *key =
- array_first(&keys.private_keys);
+ array_front(&keys.private_keys);
buffer_set_used_size(key_id, 0);
test_assert(dcrypt_key_id_private(key->key, MAIL_CRYPT_KEY_ID_ALGORITHM, key_id, &error) == TRUE);
return;
}
/* use the first quota root for everything */
- refresh_root = array_first(&refresh->roots);
+ refresh_root = array_front(&refresh->roots);
array_foreach("a->roots, rootp) {
if ((*rootp)->backend.name == quota_backend_imapc.name) {
anything we didn't expect. */
while (array_count(&root->refresh.roots) > 0) {
const struct imapc_quota_refresh_root *refresh_root =
- array_first(&root->refresh.roots);
+ array_front(&root->refresh.roots);
if (strcmp(refresh_root->name, root->root_name) == 0)
break;
array_pop_front(&root->refresh.roots);
}
array_append_zero(&kw_strings);
return mailbox_keywords_create_valid(dest_box,
- array_first(&kw_strings));
+ array_front(&kw_strings));
}
int virtual_save_begin(struct mail_save_context *_ctx, struct istream *input)
keywords = mail_index_get_keywords(ctx->index);
ctx->kw_all = array_count(keywords) == 0 ? NULL :
- array_first(keywords);
+ array_front(keywords);
while (mail_index_sync_next(ctx->index_sync_ctx, &sync_rec)) {
if (virtual_sync_index_rec(ctx, &sync_rec) < 0)
return -1;
if (!virtual_sync_find_seqs(bbox, &sync_rec,
&idx1, &idx2))
break;
- uidmap = array_first(&bbox->uids);
+ uidmap = array_front(&bbox->uids);
for (; idx1 <= idx2; idx1++) {
vuid = uidmap[idx1].virtual_uid;
if (vuid == 0) {
env_put(*envs);
}
- args = array_first(&exec_args);
+ args = array_front(&exec_args);
execvp_const(args[0], args);
}
if (noreply) {
/* no need to fork and check exit status */
- exec_child(conn, args, array_first(&envs));
+ exec_child(conn, args, array_front(&envs));
i_unreached();
}
if (pid == 0) {
/* child */
- exec_child(conn, args, array_first(&envs));
+ exec_child(conn, args, array_front(&envs));
i_unreached();
}
argv += optind;
array_append_zero(&aenvs);
- accepted_envs = p_strarray_dup(default_pool, array_first(&aenvs));
+ accepted_envs = p_strarray_dup(default_pool, array_front(&aenvs));
master_service_init_log(master_service, "script: ");
if (argv[0] == NULL)