diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-27 12:39:26 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-27 15:21:26 +0200 |
commit | 622bc770d5f8d7500fa409993c8fef8de5736962 (patch) | |
tree | aacae6e0010ac0e3f4f78df5c10ac326514a3e19 /mu | |
parent | 8c834b60399ac1ef71569a4cedee25bd30b8d07c (diff) | |
download | mailutils-622bc770d5f8d7500fa409993c8fef8de5736962.tar.gz mailutils-622bc770d5f8d7500fa409993c8fef8de5736962.tar.bz2 |
Revise associative array API
* configure.ac (VI_REVISION): Increase.
* include/mailutils/assoc.h (mu_assoc_create): Change prototype.
(mu_assoc_ref,mu_assoc_ref_install)
(mu_assoc_remove_ref): Remove.
(mu_assoc_get): New proto.
(mu_assoc_lookup,mu_assoc_lookup_ref): New proto.
(mu_assoc_install_ref): New proto.
(mu_assoc_set_free): Remove.
(mu_assoc_set_destroy_item): Set proto.
* include/mailutils/types.hin (mu_deallocator_t): New typedef.
* include/mailutils/list.h (mu_list_destroy_item_t): Change definition.
* libmailutils/base/assoc.c: Rewrite. Link all entries in
a doubly-linked list to preserve natural ordering during iterations.
* libmailutils/base/mutil.c (mutil_parse_field_map): Update calls
to assoc API.
* libmailutils/cfg/driver.c (alloc_section_tab)
(mu_create_canned_section,mu_create_canned_param)
(mu_get_canned_container,parse_mapping)
(mu_cfg_field_map): Likewise.
* libmailutils/mime/mimehdr.c (_mu_mime_param_free): Free the pointer
itself.
(flush_param,mu_mime_param_assoc_create)
(mu_mime_param_assoc_add)
(_mime_header_parse)
(mu_mimehdr_aget_decoded_param): Update calls to assoc API.
(mu_mime_param_free): New function.
* libmailutils/property/assocprop.c: Likewise.
* libmu_sieve/environment.c: Likewise.
* libmu_sieve/variables.c: Likewise.
* libproto/imap/id.c: Likewise.
* mail/alias.c: Likewise.
* mail/testsuite/mail/alias.exp: Update ordering of expected output.
* mu/imap.c (com_id): Update.
* include/mailutils/mime.h (mu_rfc2047_decode_param): Change prototype.
* libmailutils/base/rfc2047.c (mu_rfc2047_decode_param): Allocate
returned value, instead of filling an already allocated structure.
* libproto/imap/fetch.c: Reflect changes.
Diffstat (limited to 'mu')
-rw-r--r-- | mu/imap.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -755,10 +755,10 @@ com_id (int argc, char **argv) { if (test) { - void *res = mu_assoc_ref (assoc, test); - if (res) + char *val = mu_assoc_get (assoc, test); + if (val) { - mu_printf ("%s: %s\n", test, *(char **)res); + mu_printf ("%s: %s\n", test, val); } else mu_printf (_("%s is not set\n"), test); @@ -772,10 +772,10 @@ com_id (int argc, char **argv) !mu_iterator_is_done (itr); mu_iterator_next (itr)) { char *key; - void *val; + char *val; - mu_iterator_current_kv (itr, (const void**)&key, &val); - mu_printf ("ID: %s %s\n", key, *(char**)val); + mu_iterator_current_kv (itr, (const void**)&key, (void**)&val); + mu_printf ("ID: %s %s\n", key, val); } mu_iterator_destroy (&itr); } |