array_append(&ips_array, ips, ips_count);
}
array_append_zero(&ips_array);
- set->proxy_self_ips = array_idx(&ips_array, 0);
+ set->proxy_self_ips = array_first(&ips_array);
return TRUE;
}
if (field->ldap_attr_name[0] == '\0') {
str_truncate(tmp_str, 0);
if (var_expand_with_funcs(tmp_str, field->value, table,
- array_idx(&var_funcs_table, 0), &ctx, &error) <= 0) {
+ array_first(&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_idx_modifiable(&ctx.attr_names, 0), 0);
+ NULL, array_first_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",
}
}
array_append_zero(&ctx.attr_names);
- *attr_names_r = array_idx_modifiable(&ctx.attr_names, 0);
+ *attr_names_r = array_first_modifiable(&ctx.attr_names);
}
static const struct var_expand_table *
}
array_append_zero(&modules);
wanted_modules = array_count(&modules) == 1 ? NULL :
- array_idx(&modules, 0);
+ array_first(&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_idx(&service_names, 0);
+ output_r->specific_services = array_first(&service_names);
}
array_sort(&matches, config_filter_parser_cmp);
array_append_zero(&matches);
- return array_idx(&matches, 0);
+ return array_first(&matches);
}
struct config_filter_parser *const *
}
array_sort(&filters, config_filter_parser_cmp_rev);
array_append_zero(&filters);
- return array_idx(&filters, 0);
+ return array_first(&filters);
}
struct config_filter_parser *const *
}
array_sort(&matches, config_filter_parser_cmp_rev);
array_append_zero(&matches);
- return array_idx(&matches, 0);
+ return array_first(&matches);
}
static bool
for (i = 0; all_roots[i] != NULL; i++)
array_append(&new_roots, &all_roots[i], 1);
array_append_zero(&new_roots);
- all_roots = array_idx(&new_roots, 0);
+ all_roots = array_first(&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_idx(&module_names, 0);
+ array_first(&module_names);
config_path = master_service_get_config_path(master_service);
/* use strcmp() instead of !=, because dovecot -n always gives us
conn->name);
hosts = mail_hosts_get(conn->dir->mail_hosts);
while (array_count(hosts) > 0) {
- hostp = array_idx(hosts, 0);
+ hostp = array_first(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_idx_modifiable(&dir->pending_requests, 0);
+ requestp = array_first_modifiable(&dir->pending_requests);
request = *requestp;
if (request->create_time +
}
array_append_zero(&tmp);
e_debug(e->event(), "Resolve success: %s",
- t_strarray_join(array_idx(&tmp, 0), ", "));
+ t_strarray_join(array_first(&tmp), ", "));
o_stream_nsend_str(client->output,
- t_strarray_join(array_idx(&tmp, 0), "\t"));
+ t_strarray_join(array_first(&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_idx(&opts, 0), &li)) > -1) {
+ while((c = getopt_long(argc, (char*const*)argv, str_c(optbuf), array_first(&opts), &li)) > -1) {
switch(c) {
case 0:
for(unsigned int i = 0; i < array_count(&pargv); i++) {
}
array_append(&cmd_args, &p, 1);
array_append_zero(&cmd_args);
- *cmd_args_r = array_idx(&cmd_args, 0);
+ *cmd_args_r = array_first(&cmd_args);
}
static const char *const *
array_append(&cmd_args, &value, 1);
}
array_append_zero(&cmd_args);
- return array_idx(&cmd_args, 0);
+ return array_first(&cmd_args);
}
static bool mirror_get_remote_cmd(struct dsync_cmd_context *ctx,
if (doveadm_mail_iter_init(&ctx->ctx, info, ctx->ctx.search_args,
ctx->wanted_fields,
- array_idx(&ctx->header_fields, 0),
+ array_first(&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_idx(&keywords, 0);
+ ctx->keywords = array_first(&keywords);
}
_ctx->search_args = doveadm_mail_build_search_args(args+1);
array_append_array(&full_args, &pargv);
mctx->args = array_idx(&full_args, args_pos);
- mctx->full_args = array_idx(&full_args, 0);
+ mctx->full_args = array_first(&full_args);
doveadm_mail_cmd_exec(mctx, wildcard_user);
doveadm_mail_cmd_free(mctx);
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_idx(&remote_sorted, 0);
+ update->cache_updates = array_first(&remote_sorted);
return;
}
i_assert(li == local_count && ri == remote_count);
if (array_count(&changes) > 0) {
array_append_zero(&changes);
- update->cache_updates = array_idx(&changes, 0);
+ update->cache_updates = array_first(&changes);
}
}
if (array_count(&add_keywords) > 0) {
array_append_zero(&add_keywords);
kw = mailbox_keywords_create_valid(mail->box,
- array_idx(&add_keywords, 0));
+ array_first(&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_idx(&remove_keywords, 0));
+ array_first(&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_idx(&keywords, 0));
+ kw = mailbox_keywords_create_valid(mail->box, array_first(&keywords));
mail_update_keywords(mail, MODIFY_REPLACE, kw);
mailbox_keywords_unref(&kw);
return NULL;
array_append_zero(&keywords);
- return array_idx(&keywords, 0);
+ return array_first(&keywords);
}
static void
T_BEGIN {
if (array_count(&access_apps) > 0) {
(void)array_append_space(&access_apps);
- main_stdio_run(access_user, array_idx(&access_apps,0));
+ main_stdio_run(access_user,
+ array_first(&access_apps));
} else {
main_stdio_run(access_user, NULL);
}
array_append(&full_patterns, &pattern, 1);
}
array_append_zero(&full_patterns); /* NULL-terminate */
- return array_idx(&full_patterns, 0);
+ return array_first(&full_patterns);
}
static void cmd_list_init(struct cmd_list_context *ctx,
}
array_append_zero(&patterns); /* NULL-terminate */
- patterns_strarr = array_idx(&patterns, 0);
+ patterns_strarr = array_first(&patterns);
if (!ctx->used_listext && !lsub && *patterns_strarr[0] == '\0') {
/* Only LIST ref "" gets us here */
cmd_list_ref_root(client, ref);
}
}
array_append_zero(&feature_strings);
- return array_idx(&feature_strings, 0);
+ return array_first(&feature_strings);
}
struct imap_search_update *
*keywords_r = NULL;
else {
array_append_zero(&keywords); /* NULL-terminate */
- *keywords_r = array_idx(&keywords, 0);
+ *keywords_r = array_first(&keywords);
}
return TRUE;
}
}
array_append_zero(dest);
- return array_idx(dest, 0);
+ return array_first(dest);
}
void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str)
unsigned int i, count;
seqs = array_get(qresync_args->qresync_sample_seqset, &count);
- uids = array_idx(qresync_args->qresync_sample_uidset, 0);
+ uids = array_first(qresync_args->qresync_sample_uidset);
i_assert(array_count(qresync_args->qresync_sample_uidset) == count);
i_assert(count > 0);
}
}
array_append_zero(&new_args);
- return array_idx(&new_args, 0);
+ return array_first(&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_idx(&exp, 0), &error) <= 0) {
+ if (var_expand(query_r, template, array_first(&exp), &error) <= 0) {
*error_r = t_strdup_printf("Failed to expand %s: %s", template, error);
return FALSE;
}
t_array_init(&id_utf16, strlen(id));
fts_icu_utf8_to_utf16(&id_utf16, id);
- *transliterator_r = utrans_openU(array_idx(&id_utf16, 0),
- array_count(&id_utf16),
- UTRANS_FORWARD, NULL, 0, &perr, &err);
+ *transliterator_r = utrans_openU(array_first(&id_utf16),
+ array_count(&id_utf16),
+ UTRANS_FORWARD, NULL, 0, &perr, &err);
if (U_FAILURE(err)) {
string_t *str = t_str_new(128);
t_array_init(&id_utf16, 8);
fts_icu_utf8_to_utf16(&id_utf16, id);
- translit = utrans_openU(array_idx(&id_utf16, 0), array_count(&id_utf16),
+ translit = utrans_openU(array_first(&id_utf16),
+ array_count(&id_utf16),
UTRANS_FORWARD, NULL, 0, &perr, &err);
test_assert(!U_FAILURE(err));
return translit;
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_idx(&src_utf16, 0),
+ test_assert(fts_icu_translate(&dest, array_first(&src_utf16),
array_count(&src_utf16),
translit, &error) == 0);
}
return -1;
array_append_zero(&fields);
- msgpart->headers = array_idx(&fields, 0);
+ msgpart->headers = array_first(&fields);
return 0;
}
array_append(&patterns, &p->pattern, 1);
}
array_append_zero(&patterns);
- return imap_match_init_multiple_real(pool, array_idx(&patterns, 0),
+ return imap_match_init_multiple_real(pool, array_first(&patterns),
inboxcase, glob->sep);
}
/* give new names to invalid keywords */
changed_count = 0;
- name_array = array_idx_modifiable(&names, 0);
+ name_array = array_first_modifiable(&names);
for (i = j = 0; i < keywords_count; i++) {
while (name_array[i][0] == '\0') {
name = t_strdup_printf("unknown-%d", j++);
}
keyword_updates = keyword_count == 0 ? NULL :
- array_idx(&sync_trans->keyword_updates, 0);
+ array_first(&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);
ber_free(bptr, 0);
array_append_zero(&attr_names);
- obj->attr_names = array_idx(&attr_names, 0);
+ obj->attr_names = array_first(&attr_names);
return 0;
}
array_append(&arr, &tmp, 1);
}
array_append_zero(&arr);
- req->input.search.attributes = array_idx_modifiable(&arr, 0);
+ req->input.search.attributes = array_first_modifiable(&arr);
}
req->send_request_cb = ldap_search_send;
if (array_count(&langs) > 0) {
array_append_zero(&langs);
data->content_language =
- p_strarray_dup(pool, array_idx(&langs, 0));
+ p_strarray_dup(pool, array_first(&langs));
}
}
if (array_count(&rfc2231_params_arr) == 0) {
/* No RFC 2231 parameters */
array_append_zero(&result); /* NULL-terminate */
- *result_r = array_idx(&result, 0);
+ *result_r = array_first(&result);
return broken ? -1 : 0;
}
}
}
array_append_zero(&result); /* NULL-terminate */
- *result_r = array_idx(&result, 0);
+ *result_r = array_first(&result);
return broken ? -1 : 0;
}
if (array_is_created(&categories)) {
array_append_zero(&categories);
- query_r->categories = array_idx(&categories, 0);
+ query_r->categories = array_first(&categories);
}
if (array_is_created(&fields)) {
array_append_zero(&fields);
- query_r->fields = array_idx(&fields, 0);
+ query_r->fields = array_first(&fields);
}
return 0;
}
}
if (input->service == NULL) {
array_append_zero(&services);
- output_r->specific_services = array_idx(&services, 0);
+ output_r->specific_services = array_first(&services);
}
} T_END;
return 0;
}
array_append_zero(&filters_tmp);
- *filters = array_idx(&filters_tmp, 0);
+ *filters = array_first(&filters_tmp);
return 0;
}
}
parser = settings_parser_init_list(service->set_pool,
- array_idx(&all_roots, 0), array_count(&all_roots),
+ array_first(&all_roots), array_count(&all_roots),
SETTINGS_PARSER_FLAG_IGNORE_UNKNOWN_KEYS);
if (fd != -1) {
}
array_append_zero(&keys);
- value = t_strarray_join(array_idx(&keys, 0), " ");
+ value = t_strarray_join(array_first(&keys), " ");
env_put(t_strconcat(DOVECOT_PRESERVE_ENVS_ENV"=", value, NULL));
}
/* Execute */
- args = array_idx(&exec_args, 0);
+ args = array_first(&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_idx(dest_arr, 0);
+ dest_strings = array_first(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_idx(&defines, 0),
+ memcpy(new_defines, array_first(&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_idx(&dynamic_parsers, 0),
+ memcpy(parent->dynamic_parsers, array_first(&dynamic_parsers),
sizeof(*parent->dynamic_parsers) *
array_count(&dynamic_parsers));
parent->struct_size = new_struct_size;
restrict_access_init(&pc_set.restrict_set);
pc = program_client_local_create
- (sendmail_bin, array_idx(&args, 0), &pc_set);
+ (sendmail_bin, array_first(&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_append(¶ms, ¶m, 1);
array_append_zero(¶ms);
- *params_r = array_idx(¶ms, 0);
+ *params_r = array_first(¶ms);
}
return 1;
}
/* build a new connect string without our settings or hosts */
array_append_zero(&connect_args);
- connect_string = t_strarray_join(array_idx(&connect_args, 0), " ");
+ connect_string = t_strarray_join(array_first(&connect_args), " ");
if (array_count(&hostnames) == 0) {
/* no hosts specified. create a default one. */
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_idx(&uids, 0);
+ range = array_first(&uids);
i_assert(range[0].seq2 - range[0].seq1 + 1 == count);
if (hdr->uid_validity == 0) {
}
}
array_append_zero(&headers);
- return array_idx(&headers, 0);
+ return array_first(&headers);
}
static bool
return;
array_append_zero(&hdr_arr);
- if (headers_have_subset(array_idx(&hdr_arr, 0), mail->fetching_headers))
+ if (headers_have_subset(array_first(&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_idx(&hdr_arr, 0));
+ array_first(&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_idx(&keywords, 0));
+ array_first(&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_idx(&header_values, 0);
+ return array_first(&header_values);
}
static int
}
array_append_zero(&header_values);
- *value_r = array_idx(&header_values, 0);
+ *value_r = array_first(&header_values);
return 0;
}
array_append_zero(&names);
new_wanted_headers =
mailbox_header_lookup_init(_mail->box,
- array_idx(&names, 0));
+ array_first(&names));
if (data->wanted_headers != NULL)
mailbox_header_lookup_unref(&data->wanted_headers);
data->wanted_headers = new_wanted_headers;
if (array_count(&headers) > 0) {
array_append_zero(&headers);
*headers_ctx_r = mailbox_header_lookup_init(box,
- array_idx(&headers, 0));
+ array_first(&headers));
}
}
}
if (array_count(&new_fields) > 0) {
mail_cache_register_fields(box->cache,
- array_idx_modifiable(&new_fields, 0),
+ array_first_modifiable(&new_fields),
array_count(&new_fields));
}
}
/* find the oldest child */
thread_sort_children(ctx, roots[i].node.idx,
&sorted_children);
- children = array_idx(&sorted_children, 0);
+ children = array_first(&sorted_children);
idx = children[0].idx;
} else {
/* dummy without children */
unsigned int i, count, child_count;
i_array_init(&sorted_children, 64);
- shadows = array_idx(&ctx->shadow_nodes, 0);
+ shadows = array_first(&ctx->shadow_nodes);
roots = array_get_modifiable(&ctx->roots, &count);
for (i = 0; i < count; i++) {
if (roots[i].ignore)
/* make msg_uidls non-NULL */
array_append_zero(&uidls);
}
- mbox->msg_uidls = array_idx(&uidls, 0);
+ mbox->msg_uidls = array_first(&uidls);
mbox->msg_count = seq;
return 0;
}
}
}
array_append_zero(&valid_patterns); /* NULL-terminate */
- ctx->valid_patterns = array_idx(&valid_patterns, 0);
+ ctx->valid_patterns = array_first(&valid_patterns);
return array_count(&valid_patterns) > 1;
}
return;
}
uids = t_new(struct seq_range, count);
- memcpy(uids, array_idx(&arg->value.seqset, 0), sizeof(*uids) * count);
+ memcpy(uids, array_first(&arg->value.seqset), sizeof(*uids) * count);
/* put them back to the range as sequences */
array_clear(&arg->value.seqset);
}
array_append_zero(&content_types);
- set->parsed_mail_attachment_content_type_filter = array_idx(&content_types, 0);
+ set->parsed_mail_attachment_content_type_filter = array_first(&content_types);
}
return TRUE;
if (ret != 0)
return ret > 0;
- range = array_idx(uids_filter, 0);
+ range = array_first(uids_filter);
min_uid = range->seq1;
/* first get UIDs of all actual expunges */
&event_filter_log_type_names[i], 1);
}
array_append_zero(&categories);
- query.categories = array_idx(&categories, 0);
+ query.categories = array_first(&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_idx(&fields, 0);
+ query.fields = array_first(&fields);
}
event_filter_add(dest, &query);
/* finish the query */
if (array_count(&categories) > 0) {
array_append_zero(&categories);
- query.categories = array_idx(&categories, 0);
+ query.categories = array_first(&categories);
}
if (array_count(&fields) > 0) {
array_append_zero(&fields);
- query.fields = array_idx(&fields, 0);
+ query.fields = array_first(&fields);
}
event_filter_add(filter, &query);
{
if (array_count(arr) == 0)
return "";
- return p_strarray_join_n(pool, array_idx(arr, 0), array_count(arr), separator);
+ return p_strarray_join_n(pool, array_first(arr), array_count(arr),
+ separator);
}
array_append(&intarr, input, i);
array_reverse(&intarr);
- output = i == 0 ? NULL : array_idx(&intarr, 0);
+ output = i == 0 ? NULL : array_first(&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_idx(&ad, 0);
+ useless_ptr = array_first(&ad);
return FATAL_TEST_FAILURE;
}
test_assert(array_count(&range) == 3);
seq_range_array_remove_nth(&range, 0, 2);
- r = array_idx(&range, 0); test_assert(r->seq1 == 3 && r->seq2 == 5);
+ r = array_first(&range); test_assert(r->seq1 == 3 && r->seq2 == 5);
seq_range_array_remove_nth(&range, 1, 4);
- r = array_idx(&range, 0); test_assert(r->seq1 == 3 && r->seq2 == 3);
+ r = array_first(&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_idx(¶ms, 0);
+ parms = array_first(¶ms);
t_array_init(¶ms, 6);
for(;*parms != NULL; parms++) {
i_assert(array_count(¶ms) == 5);
/* execute comparison */
- const char *const *args = array_idx(¶ms, 0);
+ const char *const *args = array_first(¶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_idx_modifiable(&table, 0);
+ return array_first_modifiable(&table);
}
alt = p_new(client->pool, const char *,
array_count(&alt_usernames) + 1);
- memcpy(alt, array_idx(&alt_usernames, 0),
+ memcpy(alt, array_first(&alt_usernames),
sizeof(*alt) * array_count(&alt_usernames));
client->alt_usernames = alt;
}
}
if (array_count(&dest_rights) > 0) {
array_append_zero(&dest_rights);
- update->rights.rights = array_idx(&dest_rights, 0);
+ update->rights.rights = array_first(&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_idx(&dest_neg_rights, 0);
+ update->rights.neg_rights = array_first(&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_idx(&rights, 0);
+ array_first(&rights);
acl_right_names_merge(pool, &new_rights, modify_rights, TRUE);
break;
case ACL_MODIFY_MODE_ADD:
random_fill(&auser->token, sizeof(auser->token));
/* try change hat */
- if (aa_change_hatv(array_idx_modifiable(&hats, 0), auser->token) < 0) {
+ if (aa_change_hatv(array_first_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_idx(&patterns, 0);
+ return array_first(&patterns);
}
static bool
str = mail_user_set_plugin_getenv(user->set, set_name);
}
array_append_zero(&patterns);
- return array_idx(&patterns, 0);
+ return array_first(&patterns);
}
static void expire_mail_user_created(struct mail_user *user)
}
array_append_zero(&box_results);
- result->box_results = array_idx_modifiable(&box_results, 0);
+ result->box_results = array_first_modifiable(&box_results);
return 0;
}
fts_result->scores_sorted = TRUE;
}
array_append_zero(&fts_results);
- result->box_results = array_idx_modifiable(&fts_results, 0);
+ result->box_results = array_first_modifiable(&fts_results);
hash_table_destroy(&mailboxes);
return 0;
}
fts_result->scores_sorted = TRUE;
}
array_append_zero(&fts_results);
- result->box_results = array_idx_modifiable(&fts_results, 0);
+ result->box_results = array_first_modifiable(&fts_results);
hash_table_destroy(&mailboxes);
return 0;
}
/* write end indexes */
o_stream_nsend(output, uidlist->cur_block_end_indexes,
old_block_count * sizeof(uint32_t));
- o_stream_nsend(output, array_idx(block_end_indexes, 0),
+ o_stream_nsend(output, array_first(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_idx(block_offsets, 0),
+ o_stream_nsend(output, array_first(block_offsets),
new_block_count * sizeof(uint32_t));
(void)o_stream_flush(output);
int ret;
T_BEGIN {
- ret = uidlist_write_array(ctx->output, array_idx(uids, 0),
+ ret = uidlist_write_array(ctx->output, array_first(uids),
array_count(uids), 0, 0, FALSE,
&ctx->list_sizes[ctx->list_idx]);
} T_END;
mail_search_args_reset(args, TRUE);
if (fts_backend_lookup_multi(backend,
- array_idx(&tmp_mailboxes, 0),
+ array_first(&tmp_mailboxes),
args, flags, &result) < 0)
return -1;
str = mail_user_plugin_getenv(user, set_name);
}
array_append_zero(&patterns);
- return array_idx(&patterns, 0);
+ return array_first(&patterns);
}
static bool fts_autoindex_exclude_match(struct mailbox *box)
array_append(&arr, &value, 1);
}
array_append_zero(&arr);
- return array_idx(&arr, 0);
+ return array_first(&arr);
}
static int
}
}
array_append_zero(&rights);
- *rights_r = array_idx(&rights, 0);
+ *rights_r = array_first(&rights);
return 0;
}
return;
}
array_append_zero(&new_rights);
- update->rights.rights = array_idx(&new_rights, 0);
+ update->rights.rights = array_first(&new_rights);
}
static int
}
array_append_zero(&kw_strings);
return mailbox_keywords_create_valid(dest_box,
- array_idx(&kw_strings, 0));
+ array_first(&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_idx(keywords, 0);
+ array_first(keywords);
while (mail_index_sync_next(ctx->index_sync_ctx, &sync_rec)) {
if (virtual_sync_index_rec(ctx, &sync_rec) < 0)
return -1;
if (noreply) {
/* no need to fork and check exit status */
- exec_child(conn, args, array_idx(&envs, 0));
+ exec_child(conn, args, array_first(&envs));
i_unreached();
}
if (pid == 0) {
/* child */
- exec_child(conn, args, array_idx(&envs, 0));
+ exec_child(conn, args, array_first(&envs));
i_unreached();
}
argv += optind;
array_append_zero(&aenvs);
- accepted_envs = p_strarray_dup(default_pool, array_idx(&aenvs, 0));
+ accepted_envs = p_strarray_dup(default_pool, array_first(&aenvs));
master_service_init_log(master_service, "script: ");
if (argv[0] == NULL)