From ca939cbb5e494b18d4faf553e715828872a6c1bc Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 11 Nov 2019 14:12:43 +0200 Subject: Get rid of the deprecated functions Below I list the removed functions along with the recipes on how to replace them. . mu_body_get_stream . mu_message_get_stream . mu_mailer_get_stream . mu_header_get_stream These functions should not be used at all. They will reappear within a couple of releases as synonyms for the corresponding _get_streamref functions, after which the latter will be gradually removed. Thus, at the end of the transition perion _get_streamref's will be replaced by _get_stream. . mu_sieve_compile_buffer Replaced by mu_sieve_compile_text. Old code: rc = mu_sieve_compile_buffer (mach, buf, bufsize, fname, line); New code: struct mu_locus_point loc = MU_LOCUS_POINT_INITIALIZER; mu_locus_point_set_file (&loc, fname); loc.mu_line = line; rc = mu_sieve_compile_text (mach, buf, bufsize, &loc); mu_locus_point_deinit (&loc); . mu_address_to_string Use mu_address_get_printable instead. . mu_address_format_string Use mu_stream_format_address instead. E.g. to print to a string: char buf[100]; stream_t str; mu_fixed_memory_stream_create (&str, buf, sizeof(buf), MU_STREAM_WRITE); rc = mu_stream_format_address (str, addr); . mu_registrar_get_list Should not be used. Use mu_registrar_get_iterator if you need to iterate over the list. . mu_mailbox_save_attributes Replaced by mu_mailbox_sync. . mu_msgset_print Use mu_stream_msgset_format. Old code: rc = mu_msgset_print (mu_stream_t str, mu_msgset_t mset); New code: rc = mu_stream_msgset_format (str, mu_msgset_fmt_imap, mset); --- include/mailutils/address.h | 10 ---------- include/mailutils/body.h | 1 - include/mailutils/header.h | 1 - include/mailutils/mailbox.h | 1 - include/mailutils/mailer.h | 1 - include/mailutils/message.h | 1 - include/mailutils/msgset.h | 2 -- include/mailutils/registrar.h | 1 - include/mailutils/sieve.h | 4 ---- libmailutils/address/address.c | 39 --------------------------------------- libmailutils/base/registrar.c | 14 -------------- libmailutils/mailbox/body.c | 7 ------- libmailutils/mailbox/header.c | 22 ++-------------------- libmailutils/mailbox/mailbox.c | 6 ------ libmailutils/mailbox/msgstream.c | 33 --------------------------------- libmailutils/mailer/mailer.c | 12 ------------ libmu_sieve/sieve-gram.y | 15 --------------- 17 files changed, 2 insertions(+), 168 deletions(-) diff --git a/include/mailutils/address.h b/include/mailutils/address.h index ea9844c5b..6aa166dd6 100644 --- a/include/mailutils/address.h +++ b/include/mailutils/address.h @@ -146,16 +146,6 @@ extern int mu_address_union (mu_address_t *a, mu_address_t b); extern int mu_stream_format_address (mu_stream_t str, mu_address_t addr); - /* Deprecated calls */ - -extern int mu_address_to_string (mu_address_t, char *, size_t, size_t *) - MU_DEPRECATED; /* Use mu_address_get_printable, if you really have to */ - -extern size_t mu_address_format_string (mu_address_t addr, char *buf, - size_t buflen) - MU_DEPRECATED; /* Use mu_stream_format_address, or any of the - _get_printable functions */ - extern int mu_validate_email (mu_address_t subaddr); diff --git a/include/mailutils/body.h b/include/mailutils/body.h index ba9864631..c8ef641f2 100644 --- a/include/mailutils/body.h +++ b/include/mailutils/body.h @@ -30,7 +30,6 @@ extern void * mu_body_get_owner (mu_body_t); extern int mu_body_is_modified (mu_body_t); extern int mu_body_clear_modified (mu_body_t); -extern int mu_body_get_stream (mu_body_t, mu_stream_t *) MU_DEPRECATED; extern int mu_body_get_streamref (mu_body_t body, mu_stream_t *pstream); extern int mu_body_set_stream (mu_body_t, mu_stream_t, void *owner); extern int mu_body_set_get_stream (mu_body_t, diff --git a/include/mailutils/header.h b/include/mailutils/header.h index f0c0d7043..25b78f543 100644 --- a/include/mailutils/header.h +++ b/include/mailutils/header.h @@ -151,7 +151,6 @@ extern int mu_header_get_field_value_unfold (mu_header_t header, size_t num, extern int mu_header_aget_field_value_unfold (mu_header_t header, size_t num, char **pvalue); -extern int mu_header_get_stream (mu_header_t, mu_stream_t *) MU_DEPRECATED; extern int mu_header_get_streamref (mu_header_t, mu_stream_t *); /* FIXME: This function does not exist: diff --git a/include/mailutils/mailbox.h b/include/mailutils/mailbox.h index e54ae88f0..dfc2146ac 100644 --- a/include/mailutils/mailbox.h +++ b/include/mailutils/mailbox.h @@ -70,7 +70,6 @@ extern int mu_mailbox_messages_recent (mu_mailbox_t, size_t *); extern int mu_mailbox_message_unseen (mu_mailbox_t, size_t *); extern int mu_mailbox_expunge (mu_mailbox_t); extern int mu_mailbox_sync (mu_mailbox_t); -extern int mu_mailbox_save_attributes (mu_mailbox_t) MU_DEPRECATED; extern int mu_mailbox_attach_ticket (mu_mailbox_t mbox); diff --git a/include/mailutils/mailer.h b/include/mailutils/mailer.h index 00287e3c1..9b0ae6eec 100644 --- a/include/mailutils/mailer.h +++ b/include/mailutils/mailer.h @@ -51,7 +51,6 @@ extern int mu_mailer_get_url_default (const char** url); extern int mu_mailer_get_property (mu_mailer_t, mu_property_t *); int mu_mailer_set_property (mu_mailer_t, mu_property_t); -extern int mu_mailer_get_stream (mu_mailer_t, mu_stream_t *) MU_DEPRECATED; extern int mu_mailer_get_streamref (mu_mailer_t, mu_stream_t *); extern int mu_mailer_set_stream (mu_mailer_t, mu_stream_t); extern int mu_mailer_get_observable (mu_mailer_t, mu_observable_t *); diff --git a/include/mailutils/message.h b/include/mailutils/message.h index f2e8b2cb5..c796c4e2d 100644 --- a/include/mailutils/message.h +++ b/include/mailutils/message.h @@ -133,7 +133,6 @@ extern int mu_message_set_header (mu_message_t, mu_header_t, void *); extern int mu_message_get_body (mu_message_t, mu_body_t *); extern int mu_message_set_body (mu_message_t, mu_body_t, void *); -extern int mu_message_get_stream (mu_message_t, mu_stream_t *) MU_DEPRECATED; extern int mu_message_get_streamref (mu_message_t, mu_stream_t *); extern int mu_message_set_stream (mu_message_t, mu_stream_t, void *); diff --git a/include/mailutils/msgset.h b/include/mailutils/msgset.h index f8b5b3f60..6eb0274f5 100644 --- a/include/mailutils/msgset.h +++ b/include/mailutils/msgset.h @@ -85,8 +85,6 @@ int mu_msgset_parse_imap (mu_msgset_t set, int mode, const char *s, int mu_stream_msgset_format (mu_stream_t str, struct mu_msgset_format const *fmt, mu_msgset_t mset); -int mu_msgset_print (mu_stream_t str, mu_msgset_t msgset) - MU_DEPRECATED; static inline int mu_msgset_imap_print (mu_stream_t str, mu_msgset_t mset) diff --git a/include/mailutils/registrar.h b/include/mailutils/registrar.h index a9e621235..38789cd40 100644 --- a/include/mailutils/registrar.h +++ b/include/mailutils/registrar.h @@ -63,7 +63,6 @@ void mu_registrar_set_default_record (mu_record_t record); /* Registration. */ int mu_registrar_get_iterator (mu_iterator_t *); -int mu_registrar_get_list (mu_list_t *) MU_DEPRECATED; int mu_registrar_lookup_scheme (const char *scheme, mu_record_t *precord); diff --git a/include/mailutils/sieve.h b/include/mailutils/sieve.h index 318b14829..d46af6909 100644 --- a/include/mailutils/sieve.h +++ b/include/mailutils/sieve.h @@ -330,10 +330,6 @@ int mu_sieve_compile (mu_sieve_machine_t mach, const char *name); int mu_sieve_compile_text (mu_sieve_machine_t mach, const char *buf, size_t bufsize, struct mu_locus_point const *pt); -int mu_sieve_compile_buffer (mu_sieve_machine_t mach, - const char *buf, int bufsize, - const char *fname, int line) - MU_DEPRECATED; int mu_sieve_mailbox (mu_sieve_machine_t mach, mu_mailbox_t mbox); int mu_sieve_message (mu_sieve_machine_t mach, mu_message_t message); int mu_sieve_disass (mu_sieve_machine_t mach); diff --git a/libmailutils/address/address.c b/libmailutils/address/address.c index 28d6cca48..f93d63bef 100644 --- a/libmailutils/address/address.c +++ b/libmailutils/address/address.c @@ -480,39 +480,6 @@ mu_address_sget_email (mu_address_t addr, size_t no, char const **sptr) DECL_GET(email) DECL_AGET(email) -size_t -mu_address_format_string (mu_address_t addr, char *buf, size_t buflen) -{ - mu_stream_t str; - int rc; - - if (!buf) - rc = mu_nullstream_create (&str, MU_STREAM_WRITE); - else - rc = mu_fixed_memory_stream_create (&str, buf, buflen, MU_STREAM_WRITE); - if (rc == 0) - { - size_t size; - - mu_stream_stat_buffer statbuf; - mu_stream_set_stat (str, MU_STREAM_STAT_MASK (MU_STREAM_STAT_OUT), - statbuf); - rc = mu_stream_format_address (str, addr); - mu_stream_destroy (&str); - if (rc) - return 0; - size = statbuf[MU_STREAM_STAT_OUT]; - if (buf) - { - if (size + 1 >= buflen) - size = buflen - 1; - buf[size] = 0; - } - return size; - } - return 0; -} - static int _address_is_group (mu_address_t addr) { @@ -631,12 +598,6 @@ mu_address_get_printable (mu_address_t addr, char *buf, size_t len, size_t *n) return rc; } -int -mu_address_to_string (mu_address_t addr, char *buf, size_t len, size_t *n) -{ - return mu_address_get_printable (addr, buf, len, n); -} - int mu_address_get_count (mu_address_t addr, size_t *pcount) { diff --git a/libmailutils/base/registrar.c b/libmailutils/base/registrar.c index debac377d..a99c29f54 100644 --- a/libmailutils/base/registrar.c +++ b/libmailutils/base/registrar.c @@ -94,20 +94,6 @@ _registrar_get_list (mu_list_t *plist) return status; } -/* Provided for backward compatibility */ -int -mu_registrar_get_list (mu_list_t *plist) -{ - static int warned; - - if (!warned) - { - mu_error (_("program uses mu_registrar_get_list(), which is deprecated")); - warned = 1; - } - return _registrar_get_list (plist); -} - int mu_registrar_get_iterator (mu_iterator_t *pitr) { diff --git a/libmailutils/mailbox/body.c b/libmailutils/mailbox/body.c index 7fbd25dc7..9fafcdef0 100644 --- a/libmailutils/mailbox/body.c +++ b/libmailutils/mailbox/body.c @@ -345,13 +345,6 @@ body_get_stream (mu_body_t body, mu_stream_t *pstream, int ref) return mu_streamref_create (pstream, body->stream); } -int -mu_body_get_stream (mu_body_t body, mu_stream_t *pstream) -{ - /* FIXME: Deprecation warning */ - return body_get_stream (body, pstream, 0); -} - int mu_body_get_streamref (mu_body_t body, mu_stream_t *pstream) { diff --git a/libmailutils/mailbox/header.c b/libmailutils/mailbox/header.c index 98433b740..3f49d59ca 100644 --- a/libmailutils/mailbox/header.c +++ b/libmailutils/mailbox/header.c @@ -1214,8 +1214,8 @@ header_size (mu_stream_t str, mu_off_t *psize) return status; } -static int -_header_get_stream (mu_header_t header, mu_stream_t *pstream, int ref) +int +mu_header_get_streamref (mu_header_t header, mu_stream_t *pstream) { if (header == NULL) return EINVAL; @@ -1238,27 +1238,9 @@ _header_get_stream (mu_header_t header, mu_stream_t *pstream, int ref) str->hdr = header; header->stream = (mu_stream_t) str; } - if (!ref) - { - *pstream = header->stream; - return 0; - } return mu_streamref_create (pstream, header->stream); } -int -mu_header_get_stream (mu_header_t header, mu_stream_t *pstream) -{ - /* FIXME: Deprecation warning */ - return _header_get_stream (header, pstream, 0); -} - -int -mu_header_get_streamref (mu_header_t header, mu_stream_t *pstream) -{ - return _header_get_stream (header, pstream, 1); -} - int mu_header_set_fill (mu_header_t header, int diff --git a/libmailutils/mailbox/mailbox.c b/libmailutils/mailbox/mailbox.c index 6065e418a..5d9a54adb 100644 --- a/libmailutils/mailbox/mailbox.c +++ b/libmailutils/mailbox/mailbox.c @@ -568,12 +568,6 @@ mu_mailbox_sync (mu_mailbox_t mbox) } /* Historic alias: */ -int -mu_mailbox_save_attributes (mu_mailbox_t mbox) -{ - return mu_mailbox_sync (mbox); -} - int mu_mailbox_expunge (mu_mailbox_t mbox) { diff --git a/libmailutils/mailbox/msgstream.c b/libmailutils/mailbox/msgstream.c index 2c7c90dfe..b897b637b 100644 --- a/libmailutils/mailbox/msgstream.c +++ b/libmailutils/mailbox/msgstream.c @@ -314,39 +314,6 @@ mkoutstream (mu_message_t msg) return status; } - -int -mu_message_get_stream (mu_message_t msg, mu_stream_t *pstream) -{ - int status; - - if (msg == NULL) - return EINVAL; - if (pstream == NULL) - return MU_ERR_OUT_PTR_NULL; - - /* FIXME: Deprecation warning */ - - if (msg->rawstream == NULL) - { - if (msg->_get_stream) - { - status = msg->_get_stream (msg, &msg->rawstream); - if (status) - return status; - } - else - { - status = mkoutstream (msg); - if (status) - return status; - status = mu_streamref_create (&msg->rawstream, msg->outstream); - } - } - *pstream = msg->rawstream; - return 0; -} - int mu_message_get_streamref (mu_message_t msg, mu_stream_t *pstream) { diff --git a/libmailutils/mailer/mailer.c b/libmailutils/mailer/mailer.c index d19857f52..dffdd3ef9 100644 --- a/libmailutils/mailer/mailer.c +++ b/libmailutils/mailer/mailer.c @@ -731,18 +731,6 @@ mu_mailer_set_stream (mu_mailer_t mailer, mu_stream_t stream) return 0; } -int -mu_mailer_get_stream (mu_mailer_t mailer, mu_stream_t * pstream) -{ - /* FIXME: Deprecation warning */ - if (mailer == NULL) - return EINVAL; - if (pstream == NULL) - return MU_ERR_OUT_PTR_NULL; - *pstream = mailer->stream; - return 0; -} - int mu_mailer_get_streamref (mu_mailer_t mailer, mu_stream_t * pstream) { diff --git a/libmu_sieve/sieve-gram.y b/libmu_sieve/sieve-gram.y index c81dcfa62..660fa1f0a 100644 --- a/libmu_sieve/sieve-gram.y +++ b/libmu_sieve/sieve-gram.y @@ -1585,19 +1585,4 @@ mu_sieve_compile_text (mu_sieve_machine_t mach, return with_machine (mach, sieve_compile_strbuf, &buf); } -int -mu_sieve_compile_buffer (mu_sieve_machine_t mach, - const char *buf, int bufsize, - const char *fname, int line) -{ - int rc; - struct mu_locus_point loc = MU_LOCUS_POINT_INITIALIZER; - mu_locus_point_set_file (&loc, fname); - loc.mu_line = line; - rc = mu_sieve_compile_text (mach, buf, bufsize, &loc); - mu_locus_point_deinit (&loc); - return rc; -} - - -- cgit v1.2.1