本文整理汇总了C++中ARRAY_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY_TYPE函数的具体用法?C++ ARRAY_TYPE怎么用?C++ ARRAY_TYPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARRAY_TYPE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_metadata_cache_fields
static void
get_metadata_cache_fields(struct mailbox *box,
struct mailbox_metadata *metadata_r)
{
const struct mail_cache_field *fields;
enum mail_cache_decision_type dec;
ARRAY_TYPE(mailbox_cache_field) *cache_fields;
struct mailbox_cache_field *cf;
unsigned int i, count;
if (box->metadata_pool == NULL) {
box->metadata_pool =
pool_alloconly_create("mailbox metadata", 1024*3);
}
fields = mail_cache_register_get_list(box->cache,
box->metadata_pool, &count);
cache_fields = p_new(box->metadata_pool,
ARRAY_TYPE(mailbox_cache_field), 1);
p_array_init(cache_fields, box->metadata_pool, count);
for (i = 0; i < count; i++) {
dec = fields[i].decision & ~MAIL_CACHE_DECISION_FORCED;
if (dec != MAIL_CACHE_DECISION_NO) {
cf = array_append_space(cache_fields);
cf->name = fields[i].name;
cf->decision = fields[i].decision;
cf->last_used = fields[i].last_used;
}
}
metadata_r->cache_fields = cache_fields;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:32,代码来源:index-status.c
示例2: OPEN_ARRAY
void OCamlFGotoCodeGen::writeData()
{
if ( redFsm->anyToStateActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TSA() );
TO_STATE_ACTIONS();
CLOSE_ARRAY() <<
"\n";
}
if ( redFsm->anyFromStateActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), FSA() );
FROM_STATE_ACTIONS();
CLOSE_ARRAY() <<
"\n";
}
if ( redFsm->anyEofActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), EA() );
EOF_ACTIONS();
CLOSE_ARRAY() <<
"\n";
}
STATE_IDS();
out << "exception Goto_again" << TOP_SEP();
}
开发者ID:Orvid,项目名称:hhvm-third-party,代码行数:27,代码来源:mlfgoto.cpp
示例3: OPEN_ARRAY
void FGotoCodeGen::writeData()
{
if ( redFsm->anyToStateActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TSA() );
TO_STATE_ACTIONS();
CLOSE_ARRAY() <<
L"\n";
}
if ( redFsm->anyFromStateActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), FSA() );
FROM_STATE_ACTIONS();
CLOSE_ARRAY() <<
L"\n";
}
if ( redFsm->anyEofActions() ) {
OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), EA() );
EOF_ACTIONS();
CLOSE_ARRAY() <<
L"\n";
}
STATE_IDS();
}
开发者ID:lazyWombat,项目名称:VSRagel,代码行数:25,代码来源:cdfgoto.cpp
示例4: MAX
void CSharpTabCodeGen::initVarTypes()
{
int klenMax = MAX(MAX(redFsm->maxCondLen, redFsm->maxRangeLen),
redFsm->maxSingleLen);
int keysMax = MAX(MAX(redFsm->maxKeyOffset, klenMax),
redFsm->maxCondOffset);
int transMax = MAX(MAX(redFsm->maxIndex+1, redFsm->maxIndexOffset), keysMax);
transMax = MAX(transMax, klenMax);
transType = ARRAY_TYPE(transMax);
klenType = ARRAY_TYPE(klenMax);
keysType = ARRAY_TYPE(keysMax);
signedKeysType = ARRAY_TYPE(keysMax, true);
}
开发者ID:lazyWombat,项目名称:VSRagel,代码行数:13,代码来源:cstable.cpp
示例5: maildir_save_set_recent_flags
static uint32_t
maildir_save_set_recent_flags(struct maildir_save_context *ctx)
{
struct maildir_mailbox *mbox = ctx->mbox;
ARRAY_TYPE(seq_range) saved_sorted_uids;
const struct seq_range *uids;
unsigned int i, count;
uint32_t uid;
count = array_count(&ctx->ctx.transaction->changes->saved_uids);
if (count == 0)
return 0;
t_array_init(&saved_sorted_uids, count);
array_append_array(&saved_sorted_uids,
&ctx->ctx.transaction->changes->saved_uids);
array_sort(&saved_sorted_uids, seq_range_cmp);
uids = array_get(&saved_sorted_uids, &count);
for (i = 0; i < count; i++) {
for (uid = uids[i].seq1; uid <= uids[i].seq2; uid++)
mailbox_recent_flags_set_uid(&mbox->box, uid);
}
return uids[count-1].seq2 + 1;
}
开发者ID:Raffprta,项目名称:core,代码行数:25,代码来源:maildir-save.c
示例6: virtual_mailbox_get_list_patterns
static void
virtual_mailbox_get_list_patterns(struct virtual_parse_context *ctx)
{
struct virtual_mailbox *mbox = ctx->mbox;
ARRAY_TYPE(mailbox_virtual_patterns) *dest;
struct mailbox_virtual_pattern pattern;
struct virtual_backend_box *const *bboxes;
unsigned int i, count;
memset(&pattern, 0, sizeof(pattern));
bboxes = array_get_modifiable(&mbox->backend_boxes, &count);
p_array_init(&mbox->list_include_patterns, ctx->pool, count);
p_array_init(&mbox->list_exclude_patterns, ctx->pool, count);
for (i = 0; i < count; i++) {
if (bboxes[i]->metadata_entry == NULL)
continue;
pattern.ns = bboxes[i]->ns;
pattern.pattern = bboxes[i]->name;
if (bboxes[i]->negative_match)
dest = &mbox->list_include_patterns;
else {
dest = &mbox->list_exclude_patterns;
pattern.pattern++;
}
array_append(dest, &pattern, 1);
}
}
开发者ID:manuelm,项目名称:dovecot,代码行数:27,代码来源:virtual-config.c
示例7: ARRAY_TYPE
ARRAY_TYPE(imap_arg_list) *
test_parse_imap_args(pool_t pool, const char *line, unsigned int linelen,
const char **error_r)
{
struct imap_parser *imap_parser;
struct istream *input;
const struct imap_arg *args;
ARRAY_TYPE(imap_arg_list) *dup_args;
enum imap_parser_error fatal;
int ret;
input = i_stream_create_from_data(line, linelen);
imap_parser = imap_parser_create(input, NULL, (size_t)-1);
ret = imap_parser_finish_line(imap_parser, 0,
IMAP_PARSE_FLAG_LITERAL8 |
IMAP_PARSE_FLAG_LITERAL_TYPE |
IMAP_PARSE_FLAG_ATOM_ALLCHARS |
IMAP_PARSE_FLAG_MULTILINE_STR, &args);
if (ret < 0) {
dup_args = NULL;
if (ret == -2)
*error_r = "Missing data";
else {
*error_r = t_strdup(imap_parser_get_error(imap_parser,
&fatal));
}
} else {
dup_args = test_parse_imap_args_dup(pool, args);
}
imap_parser_unref(&imap_parser);
i_stream_unref(&input);
return dup_args;
}
开发者ID:dovecot,项目名称:imaptest,代码行数:33,代码来源:test-parser.c
示例8: env_clean_except_real
static void env_clean_except_real(const char *const preserve_envs[])
{
ARRAY_TYPE(const_string) copy;
const char *value, *const *envp;
unsigned int i;
t_array_init(©, 16);
for (i = 0; preserve_envs[i] != NULL; i++) {
const char *key = preserve_envs[i];
value = getenv(key);
if (value != NULL) {
value = t_strconcat(key, "=", value, NULL);
array_append(©, &value, 1);
}
}
/* Note that if the original environment was set with env_put(), the
environment strings will be invalid after env_clean(). That's why
we t_strconcat() them above. */
env_clean();
array_foreach(©, envp)
env_put(*envp);
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:25,代码来源:env-util.c
示例9: test_seq_range_array_remove_nth
static void test_seq_range_array_remove_nth(void)
{
ARRAY_TYPE(seq_range) range;
const struct seq_range *r;
test_begin("seq_range_array_remove_nth()");
t_array_init(&range, 8);
seq_range_array_add_range(&range, 1, 5);
seq_range_array_add(&range, 7);
seq_range_array_add_range(&range, 10,20);
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);
seq_range_array_remove_nth(&range, 1, 4);
r = array_idx(&range, 0); 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);
r = array_idx(&range, 1); test_assert(r->seq1 == 11 && r->seq2 == 14);
test_assert(array_count(&range) == 2);
test_end();
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:25,代码来源:test-seq-range-array.c
示例10: cmd_deduplicate_uidlist
static int cmd_deduplicate_uidlist(struct mailbox *box, struct uidlist *uidlist)
{
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
struct mail_search_args *search_args;
struct mail_search_arg *arg;
struct mail *mail;
ARRAY_TYPE(seq_range) uids;
int ret = 0;
/* the uidlist is reversed with oldest mails at the end.
we'll delete everything but the oldest mail. */
if (uidlist->next == NULL)
return 0;
t_array_init(&uids, 8);
for (; uidlist->next != NULL; uidlist = uidlist->next)
seq_range_array_add(&uids, uidlist->uid);
search_args = mail_search_build_init();
arg = mail_search_build_add(search_args, SEARCH_UIDSET);
arg->value.seqset = uids;
trans = mailbox_transaction_begin(box, 0);
search_ctx = mailbox_search_init(trans, search_args, NULL, 0, NULL);
mail_search_args_unref(&search_args);
while (mailbox_search_next(search_ctx, &mail))
mail_expunge(mail);
if (mailbox_search_deinit(&search_ctx) < 0)
ret = -1;
if (mailbox_transaction_commit(&trans) < 0)
ret = -1;
return ret;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:35,代码来源:doveadm-mail-deduplicate.c
示例11: dbox_sync_index_copy_from_old
static void
dbox_sync_index_copy_from_old(struct dbox_sync_rebuild_context *ctx,
struct mail_index_view *view,
uint32_t old_seq, uint32_t new_seq)
{
struct mail_index *index = mail_index_view_get_index(view);
const struct mail_index_record *rec;
ARRAY_TYPE(keyword_indexes) old_keywords;
struct mail_keywords *kw;
uint64_t modseq;
/* copy flags */
rec = mail_index_lookup(view, old_seq);
mail_index_update_flags(ctx->trans, new_seq,
MODIFY_REPLACE, rec->flags);
/* copy keywords */
t_array_init(&old_keywords, 32);
mail_index_lookup_keywords(view, old_seq, &old_keywords);
kw = mail_index_keywords_create_from_indexes(index, &old_keywords);
mail_index_update_keywords(ctx->trans, new_seq, MODIFY_REPLACE, kw);
mail_index_keywords_unref(&kw);
/* copy modseq */
modseq = mail_index_modseq_lookup(view, old_seq);
mail_index_update_modseq(ctx->trans, new_seq, modseq);
dbox_sync_index_copy_cache(ctx, view, old_seq, new_seq);
}
开发者ID:aosm,项目名称:dovecot,代码行数:29,代码来源:dbox-sync-rebuild.c
示例12: mirror_get_remote_cmd_line
static void
mirror_get_remote_cmd_line(const char *const *argv,
const char *const **cmd_args_r)
{
ARRAY_TYPE(const_string) cmd_args;
unsigned int i;
const char *p;
i_assert(argv[0] != NULL);
t_array_init(&cmd_args, 16);
for (i = 0; argv[i] != NULL; i++) {
p = argv[i];
array_append(&cmd_args, &p, 1);
}
if (legacy_dsync) {
/* we're executing dsync */
p = "server";
} else {
/* we're executing doveadm */
p = "dsync-server";
}
array_append(&cmd_args, &p, 1);
array_append_zero(&cmd_args);
*cmd_args_r = array_idx(&cmd_args, 0);
}
开发者ID:damoxc,项目名称:dovecot,代码行数:27,代码来源:doveadm-dsync.c
示例13: boundaries_permute
static void
boundaries_permute(uint32_t *input, unsigned int i, unsigned int count)
{
ARRAY_TYPE(seq_range) range;
const struct seq_range *seqs;
unsigned int seqs_count;
uint32_t tmp;
unsigned int j;
if (i+1 < count) {
for (j = i; j < count; j++) {
tmp = input[i]; input[i] = input[j]; input[j] = tmp;
boundaries_permute(input, i+1, count);
tmp = input[i]; input[i] = input[j]; input[j] = tmp;
}
return;
}
t_array_init(&range, 4);
for (i = 0; i < count; i++)
seq_range_array_add(&range, input[i]);
seqs = array_get(&range, &seqs_count);
test_assert(seqs_count == 2);
test_assert(seqs[0].seq1 == 0);
test_assert(seqs[0].seq2 == 1);
test_assert(seqs[1].seq1 == (uint32_t)-2);
test_assert(seqs[1].seq2 == (uint32_t)-1);
}
开发者ID:Distrotech,项目名称:dovecot,代码行数:27,代码来源:test-seq-range-array.c
示例14: acl_rights_update_import
int acl_rights_update_import(struct acl_rights_update *update,
const char *id, const char *const *rights,
const char **error_r)
{
ARRAY_TYPE(const_string) dest_rights, dest_neg_rights, *dest;
unsigned int i, j;
if (acl_identifier_parse(id, &update->rights) < 0) {
*error_r = t_strdup_printf("Invalid ID: %s", id);
return -1;
}
if (rights == NULL) {
update->modify_mode = ACL_MODIFY_MODE_CLEAR;
update->neg_modify_mode = ACL_MODIFY_MODE_CLEAR;
return 0;
}
t_array_init(&dest_rights, 8);
t_array_init(&dest_neg_rights, 8);
for (i = 0; rights[i] != NULL; i++) {
const char *right = rights[i];
if (right[0] != '-')
dest = &dest_rights;
else {
right++;
dest = &dest_neg_rights;
}
if (strcmp(right, "all") != 0) {
if (*right == ':') {
/* non-standard right */
right++;
array_append(dest, &right, 1);
} else if (is_standard_right(right)) {
array_append(dest, &right, 1);
} else {
*error_r = t_strdup_printf("Invalid right '%s'",
right);
return -1;
}
} else {
for (j = 0; all_mailbox_rights[j] != NULL; j++)
array_append(dest, &all_mailbox_rights[j], 1);
}
}
if (array_count(&dest_rights) > 0) {
array_append_zero(&dest_rights);
update->rights.rights = array_idx(&dest_rights, 0);
} 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);
} else if (update->neg_modify_mode == ACL_MODIFY_MODE_REPLACE) {
update->neg_modify_mode = ACL_MODIFY_MODE_CLEAR;
}
return 0;
}
开发者ID:bdraco,项目名称:dovecot,代码行数:59,代码来源:acl-api.c
示例15: write_IP
/**
* Callback for Modbus write register function
* for setting a new IP address.
*
* High-Byte of value is always the left most IP segment!
* How to set a new IP:
* 1) Write higher 2 segments at num IP_HIGH.
* 2) Write lower 2 segments at num IP_LOW.
* New IP is stored in EEPROM.
* New IP address will be activated after Modbus transmission has
* been confirmed with old IP address.
*
* Example:
* write_IP(IP_HIGH, 0xC0A8); // 192.168
* write_IP(IP_LOW, 0x00A8); // 0.111
*
* @param num Register number
* @param value Two 8-bit values for IPv4 segments
* @return True if value was written successfully
**/
uint8_t write_IP(uint8_t num, uint16_t value) {
switch (num) {
case IP_HIGH:
config.ip[0] = (ARRAY_TYPE(config.ip))(value >> 8);
config.ip[1] = (ARRAY_TYPE(config.ip))value;
break;
case IP_LOW:
config.ip[2] = (ARRAY_TYPE(config.ip))(value >> 8);
config.ip[3] = (ARRAY_TYPE(config.ip))value;
eeprom_update_block(config.ip, eeConfig.ip, sizeof(config.ip));
renewIP = 1;
break;
default:
return 0;
}
return 1;
}
开发者ID:schugabe,项目名称:FWS,代码行数:37,代码来源:sensor_main.c
示例16: pop3c_sync_get_uidls
int pop3c_sync_get_uidls(struct pop3c_mailbox *mbox)
{
ARRAY_TYPE(const_string) uidls;
struct istream *input;
const char *error, *cline;
char *line, *p;
unsigned int seq, line_seq;
if (mbox->msg_uidls != NULL)
return 0;
if ((pop3c_client_get_capabilities(mbox->client) &
POP3C_CAPABILITY_UIDL) == 0) {
mail_storage_set_error(mbox->box.storage,
MAIL_ERROR_NOTPOSSIBLE,
"UIDLs not supported by server");
return -1;
}
if (pop3c_client_cmd_stream(mbox->client, "UIDL\r\n",
&input, &error) < 0) {
mail_storage_set_critical(mbox->box.storage,
"UIDL failed: %s", error);
return -1;
}
mbox->uidl_pool = pool_alloconly_create("POP3 UIDLs", 1024*32);
p_array_init(&uidls, mbox->uidl_pool, 64); seq = 0;
while ((line = i_stream_read_next_line(input)) != NULL) {
seq++;
p = strchr(line, ' ');
if (p == NULL) {
mail_storage_set_critical(mbox->box.storage,
"Invalid UIDL line: %s", line);
break;
}
*p++ = '\0';
if (str_to_uint(line, &line_seq) < 0 || line_seq != seq) {
mail_storage_set_critical(mbox->box.storage,
"Unexpected UIDL seq: %s != %u", line, seq);
break;
}
cline = p_strdup(mbox->uidl_pool, p);
array_append(&uidls, &cline, 1);
}
i_stream_destroy(&input);
if (line != NULL) {
pool_unref(&mbox->uidl_pool);
return -1;
}
if (seq == 0) {
/* make msg_uidls non-NULL */
array_append_zero(&uidls);
}
mbox->msg_uidls = array_idx(&uidls, 0);
mbox->msg_count = seq;
return 0;
}
开发者ID:manuelm,项目名称:dovecot,代码行数:58,代码来源:pop3c-sync.c
示例17: main
int main(int argc, char *argv[])
{
ARRAY_TYPE(const_string) aenvs;
const char *binary;
const char *const *envs;
int c, i;
master_service = master_service_init("script", 0, &argc, &argv, "+e:");
t_array_init(&aenvs, 16);
while ((c = master_getopt(master_service)) > 0) {
switch (c) {
case 'e':
envs = t_strsplit_spaces(optarg,", \t");
while (*envs != NULL) {
array_append(&aenvs, envs, 1);
envs++;
}
break;
default:
return FATAL_DEFAULT;
}
}
argc -= optind;
argv += optind;
array_append_zero(&aenvs);
accepted_envs = p_strarray_dup(default_pool, array_idx(&aenvs, 0));
master_service_init_log(master_service, "script: ");
if (argv[0] == NULL)
i_fatal("Missing script path");
restrict_access_by_env(RESTRICT_ACCESS_FLAG_ALLOW_ROOT, NULL);
restrict_access_allow_coredumps(TRUE);
master_service_init_finish(master_service);
master_service_set_service_count(master_service, 1);
if (argv[0][0] == '/')
binary = argv[0];
else
binary = t_strconcat(PKG_LIBEXECDIR"/", argv[0], NULL);
i_array_init(&exec_args, argc + 16);
array_append(&exec_args, &binary, 1);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
array_append(&exec_args, &arg, 1);
}
master_service_run(master_service, client_connected);
array_free(&exec_args);
i_free(accepted_envs);
master_service_deinit(&master_service);
return 0;
}
开发者ID:zatsepin,项目名称:core,代码行数:57,代码来源:script.c
示例18: index_sort_list_finish_size
static void
index_sort_list_finish_size(struct mail_search_sort_program *program)
{
ARRAY_TYPE(mail_sort_node_size) *nodes = program->context;
array_sort(nodes, sort_node_size_cmp);
memcpy(&program->seqs, nodes, sizeof(program->seqs));
i_free(nodes);
program->context = NULL;
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:10,代码来源:index-sort.c
示例19: index_sort_list_add_pop3_order
static void
index_sort_list_add_pop3_order(struct mail_search_sort_program *program,
struct mail *mail)
{
ARRAY_TYPE(mail_sort_node_size) *nodes = program->context;
struct mail_sort_node_size *node;
node = array_append_space(nodes);
node->seq = mail->seq;
node->size = index_sort_get_pop3_order(mail);
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:11,代码来源:index-sort.c
示例20: index_sort_list_add_relevancy
static void
index_sort_list_add_relevancy(struct mail_search_sort_program *program,
struct mail *mail)
{
ARRAY_TYPE(mail_sort_node_float) *nodes = program->context;
struct mail_sort_node_float *node;
node = array_append_space(nodes);
node->seq = mail->seq;
node->num = index_sort_get_relevancy(mail);
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:11,代码来源:index-sort.c
注:本文中的ARRAY_TYPE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论