dovecot-1.2: Added more consts, ATTR_CONSTs and ATTR_PUREs.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jun 20 10:41:57 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/81806d402514
changeset: 7912:81806d402514
user: Timo Sirainen <tss at iki.fi>
date: Fri Jun 20 10:41:44 2008 +0300
description:
Added more consts, ATTR_CONSTs and ATTR_PUREs.
diffstat:
43 files changed, 141 insertions(+), 123 deletions(-)
src/imap/commands-util.c | 4 ++--
src/imap/commands-util.h | 5 +++--
src/lib-charset/charset-utf8.h | 2 +-
src/lib-imap/imap-bodystructure.c | 6 +++---
src/lib-imap/imap-bodystructure.h | 3 ++-
src/lib-mail/message-header-parser.c | 2 +-
src/lib-mail/message-header-parser.h | 3 ++-
src/lib-storage/mail-namespace.c | 4 ++--
src/lib-storage/mail-namespace.h | 5 +++--
src/lib-storage/mail-storage.c | 14 +++++++-------
src/lib-storage/mail-storage.h | 15 +++++++++------
src/lib-storage/mailbox-list.c | 9 +++++----
src/lib-storage/mailbox-list.h | 11 +++++++----
src/lib/aqueue.h | 4 ++--
src/lib/array.c | 2 +-
src/lib/array.h | 9 +++++----
src/lib/buffer.c | 6 +++---
src/lib/buffer.h | 7 ++++---
src/lib/crc32.h | 4 ++--
src/lib/data-stack.h | 2 +-
src/lib/hash.h | 8 ++++----
src/lib/hex-dec.h | 2 +-
src/lib/istream.c | 17 +++++++++--------
src/lib/istream.h | 7 ++++---
src/lib/lib.h | 2 +-
src/lib/network.h | 14 +++++++-------
src/lib/ostream-file.c | 9 +++++----
src/lib/ostream-internal.h | 2 +-
src/lib/ostream.c | 4 ++--
src/lib/ostream.h | 2 +-
src/lib/primes.h | 2 +-
src/lib/priorityq.h | 2 +-
src/lib/seq-range-array.h | 7 ++++---
src/lib/str.h | 6 +++---
src/lib/strfuncs.h | 16 ++++++++--------
src/lib/unichar.h | 9 +++++----
src/lib/var-expand.h | 2 +-
src/login-common/client-common.h | 2 +-
src/login-common/login-proxy.c | 6 +++---
src/login-common/login-proxy.h | 8 ++++----
src/login-common/ssl-proxy-openssl.c | 6 +++---
src/login-common/ssl-proxy.c | 6 +++---
src/login-common/ssl-proxy.h | 8 ++++----
diffs (truncated from 940 to 300 lines):
diff -r 3d65aeed7ea0 -r 81806d402514 src/imap/commands-util.c
--- a/src/imap/commands-util.c Fri Jun 20 10:41:27 2008 +0300
+++ b/src/imap/commands-util.c Fri Jun 20 10:41:44 2008 +0300
@@ -321,8 +321,8 @@ client_get_keyword_names(struct client *
return array_idx(dest, 0);
}
-bool mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
- const char *name2)
+bool mailbox_equals(const struct mailbox *box1,
+ const struct mail_storage *storage2, const char *name2)
{
struct mail_storage *storage1 = mailbox_get_storage(box1);
const char *name1;
diff -r 3d65aeed7ea0 -r 81806d402514 src/imap/commands-util.h
--- a/src/imap/commands-util.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/imap/commands-util.h Fri Jun 20 10:41:44 2008 +0300
@@ -61,8 +61,9 @@ client_get_keyword_names(struct client *
client_get_keyword_names(struct client *client, ARRAY_TYPE(keywords) *dest,
const ARRAY_TYPE(keyword_indexes) *src);
-bool mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
- const char *name2);
+bool mailbox_equals(const struct mailbox *box1,
+ const struct mail_storage *storage2,
+ const char *name2) ATTR_PURE;
void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str);
void msgset_generator_next(struct msgset_generator_context *ctx, uint32_t uid);
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-charset/charset-utf8.h
--- a/src/lib-charset/charset-utf8.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-charset/charset-utf8.h Fri Jun 20 10:41:44 2008 +0300
@@ -21,7 +21,7 @@ void charset_to_utf8_reset(struct charse
void charset_to_utf8_reset(struct charset_translation *t);
/* Returns TRUE if charset is UTF-8 or ASCII */
-bool charset_is_utf8(const char *charset);
+bool charset_is_utf8(const char *charset) ATTR_PURE;
/* Translate src to UTF-8. src_size is updated to contain the number of
characters actually translated from src. */
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-imap/imap-bodystructure.c
--- a/src/lib-imap/imap-bodystructure.c Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-imap/imap-bodystructure.c Fri Jun 20 10:41:44 2008 +0300
@@ -446,9 +446,9 @@ static void part_write_body(const struct
}
}
-bool imap_bodystructure_is_plain_7bit(struct message_part *part)
-{
- struct message_part_body_data *data = part->context;
+bool imap_bodystructure_is_plain_7bit(const struct message_part *part)
+{
+ const struct message_part_body_data *data = part->context;
i_assert(part->parent == NULL);
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-imap/imap-bodystructure.h
--- a/src/lib-imap/imap-bodystructure.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-imap/imap-bodystructure.h Fri Jun 20 10:41:44 2008 +0300
@@ -10,7 +10,8 @@ void imap_bodystructure_parse_header(poo
/* Returns TRUE if BODYSTRUCTURE is
("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" n n NIL NIL NIL) */
-bool imap_bodystructure_is_plain_7bit(struct message_part *part);
+bool imap_bodystructure_is_plain_7bit(const struct message_part *part)
+ ATTR_PURE;
void imap_bodystructure_write(const struct message_part *part,
string_t *dest, bool extended);
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-mail/message-header-parser.c
--- a/src/lib-mail/message-header-parser.c Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-mail/message-header-parser.c Fri Jun 20 10:41:44 2008 +0300
@@ -370,7 +370,7 @@ int message_parse_header_next(struct mes
return 1;
}
-bool message_parse_header_has_nuls(struct message_header_parser_ctx *ctx)
+bool message_parse_header_has_nuls(const struct message_header_parser_ctx *ctx)
{
return ctx->has_nuls;
}
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-mail/message-header-parser.h
--- a/src/lib-mail/message-header-parser.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-mail/message-header-parser.h Fri Jun 20 10:41:44 2008 +0300
@@ -55,7 +55,8 @@ int message_parse_header_next(struct mes
struct message_header_line **hdr_r);
/* Returns TRUE if the parser has seen NUL characters. */
-bool message_parse_header_has_nuls(struct message_header_parser_ctx *ctx);
+bool message_parse_header_has_nuls(const struct message_header_parser_ctx *ctx)
+ ATTR_PURE;
/* Read and parse the header from the given stream. */
void message_parse_header(struct istream *input, struct message_size *hdr_size,
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-storage/mail-namespace.c Fri Jun 20 10:41:44 2008 +0300
@@ -313,7 +313,7 @@ const char *mail_namespace_get_vname(str
return str_c(dest);
}
-char mail_namespace_get_root_sep(struct mail_namespace *namespaces)
+char mail_namespace_get_root_sep(const struct mail_namespace *namespaces)
{
while ((namespaces->flags & NAMESPACE_FLAG_LIST) == 0)
namespaces = namespaces->next;
@@ -401,7 +401,7 @@ mail_namespace_find_inbox(struct mail_na
return namespaces;
}
-bool mail_namespace_update_name(struct mail_namespace *ns,
+bool mail_namespace_update_name(const struct mail_namespace *ns,
const char **mailbox)
{
struct mail_namespace tmp_ns = *ns;
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-storage/mail-namespace.h
--- a/src/lib-storage/mail-namespace.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-storage/mail-namespace.h Fri Jun 20 10:41:44 2008 +0300
@@ -53,7 +53,8 @@ const char *mail_namespace_get_vname(str
const char *name);
/* Returns the hierarchy separator for mailboxes that are listed at root. */
-char mail_namespace_get_root_sep(struct mail_namespace *namespaces);
+char mail_namespace_get_root_sep(const struct mail_namespace *namespaces)
+ ATTR_PURE;
/* Returns namespace based on the mailbox name's prefix. Updates mailbox to
be a valid name inside the namespace (prefix is skipped, hierarchy separator
@@ -73,7 +74,7 @@ mail_namespace_find_inbox(struct mail_na
mail_namespace_find_inbox(struct mail_namespace *namespaces);
/* Returns TRUE if the given namespace matches the mailbox's prefix.
Updates mailbox name to be a valid name inside the namespace. */
-bool mail_namespace_update_name(struct mail_namespace *ns,
+bool mail_namespace_update_name(const struct mail_namespace *ns,
const char **mailbox);
/* Find a namespace with given prefix. */
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-storage/mail-storage.c Fri Jun 20 10:41:44 2008 +0300
@@ -328,12 +328,13 @@ char mail_storage_get_hierarchy_sep(stru
return mailbox_list_get_hierarchy_sep(storage->list);
}
-struct mailbox_list *mail_storage_get_list(struct mail_storage *storage)
+struct mailbox_list *mail_storage_get_list(const struct mail_storage *storage)
{
return storage->list;
}
-struct mail_namespace *mail_storage_get_namespace(struct mail_storage *storage)
+struct mail_namespace *
+mail_storage_get_namespace(const struct mail_storage *storage)
{
return storage->ns;
}
@@ -488,12 +489,12 @@ int mailbox_close(struct mailbox **_box)
return box->v.close(box);
}
-struct mail_storage *mailbox_get_storage(struct mailbox *box)
+struct mail_storage *mailbox_get_storage(const struct mailbox *box)
{
return box->storage;
}
-const char *mailbox_get_name(struct mailbox *box)
+const char *mailbox_get_name(const struct mailbox *box)
{
return box->name;
}
@@ -566,7 +567,6 @@ void mailbox_notify_changes(struct mailb
void mailbox_notify_changes_stop(struct mailbox *box)
{
-
mailbox_notify_changes(box, 0, NULL, NULL);
}
@@ -755,13 +755,13 @@ void mailbox_transaction_rollback(struct
t->box->v.transaction_rollback(t);
}
-unsigned int mailbox_transaction_get_count(struct mailbox *box)
+unsigned int mailbox_transaction_get_count(const struct mailbox *box)
{
return box->transaction_count;
}
struct mailbox *
-mailbox_transaction_get_mailbox(struct mailbox_transaction_context *t)
+mailbox_transaction_get_mailbox(const struct mailbox_transaction_context *t)
{
return t->box;
}
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-storage/mail-storage.h Fri Jun 20 10:41:44 2008 +0300
@@ -250,8 +250,10 @@ void mail_storage_destroy(struct mail_st
void mail_storage_destroy(struct mail_storage **storage);
char mail_storage_get_hierarchy_sep(struct mail_storage *storage);
-struct mailbox_list *mail_storage_get_list(struct mail_storage *storage);
-struct mail_namespace *mail_storage_get_namespace(struct mail_storage *storage);
+struct mailbox_list *
+mail_storage_get_list(const struct mail_storage *storage) ATTR_PURE;
+struct mail_namespace *
+mail_storage_get_namespace(const struct mail_storage *storage) ATTR_PURE;
/* Set storage callback functions to use. */
void mail_storage_set_callbacks(struct mail_storage *storage,
@@ -302,10 +304,10 @@ enum mailbox_feature mailbox_get_enabled
enum mailbox_feature mailbox_get_enabled_features(struct mailbox *box);
/* Returns storage of given mailbox */
-struct mail_storage *mailbox_get_storage(struct mailbox *box);
+struct mail_storage *mailbox_get_storage(const struct mailbox *box) ATTR_PURE;
/* Returns name of given mailbox */
-const char *mailbox_get_name(struct mailbox *box);
+const char *mailbox_get_name(const struct mailbox *box) ATTR_PURE;
/* Returns TRUE if mailbox is read-only. */
bool mailbox_is_readonly(struct mailbox *box);
@@ -357,10 +359,11 @@ int mailbox_transaction_commit_get_uids(
uint32_t *last_saved_uid_r);
void mailbox_transaction_rollback(struct mailbox_transaction_context **t);
/* Return the number of active transactions for the mailbox. */
-unsigned int mailbox_transaction_get_count(struct mailbox *box);
+unsigned int mailbox_transaction_get_count(const struct mailbox *box) ATTR_PURE;
struct mailbox *
-mailbox_transaction_get_mailbox(struct mailbox_transaction_context *t);
+mailbox_transaction_get_mailbox(const struct mailbox_transaction_context *t)
+ ATTR_PURE;
/* Build mail_keywords from NULL-terminated keywords list.
Returns 0 if successful, -1 if there are invalid keywords (error is set). */
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-storage/mailbox-list.c Fri Jun 20 10:41:44 2008 +0300
@@ -216,22 +216,23 @@ void mailbox_list_deinit(struct mailbox_
list->v.deinit(list);
}
-const char *mailbox_list_get_driver_name(struct mailbox_list *list)
+const char *mailbox_list_get_driver_name(const struct mailbox_list *list)
{
return list->name;
}
-char mailbox_list_get_hierarchy_sep(struct mailbox_list *list)
+char mailbox_list_get_hierarchy_sep(const struct mailbox_list *list)
{
return list->hierarchy_sep;
}
-enum mailbox_list_flags mailbox_list_get_flags(struct mailbox_list *list)
+enum mailbox_list_flags mailbox_list_get_flags(const struct mailbox_list *list)
{
return list->flags;
}
-struct mail_namespace *mailbox_list_get_namespace(struct mailbox_list *list)
+struct mail_namespace *
+mailbox_list_get_namespace(const struct mailbox_list *list)
{
return list->ns;
}
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib-storage/mailbox-list.h
--- a/src/lib-storage/mailbox-list.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib-storage/mailbox-list.h Fri Jun 20 10:41:44 2008 +0300
@@ -128,10 +128,13 @@ void mailbox_list_init(struct mailbox_li
enum mailbox_list_flags flags);
void mailbox_list_deinit(struct mailbox_list *list);
-const char *mailbox_list_get_driver_name(struct mailbox_list *list);
-char mailbox_list_get_hierarchy_sep(struct mailbox_list *list);
-enum mailbox_list_flags mailbox_list_get_flags(struct mailbox_list *list);
-struct mail_namespace *mailbox_list_get_namespace(struct mailbox_list *list);
+const char *
+mailbox_list_get_driver_name(const struct mailbox_list *list) ATTR_PURE;
+char mailbox_list_get_hierarchy_sep(const struct mailbox_list *list) ATTR_PURE;
+enum mailbox_list_flags
+mailbox_list_get_flags(const struct mailbox_list *list) ATTR_PURE;
+struct mail_namespace *
+mailbox_list_get_namespace(const struct mailbox_list *list) ATTR_PURE;
/* Returns the mode and GID that should be used when creating new global files
to the mailbox list root directories. (gid_t)-1 is returned if it's not
diff -r 3d65aeed7ea0 -r 81806d402514 src/lib/aqueue.h
--- a/src/lib/aqueue.h Fri Jun 20 10:41:27 2008 +0300
+++ b/src/lib/aqueue.h Fri Jun 20 10:41:44 2008 +0300
@@ -29,10 +29,10 @@ void aqueue_clear(struct aqueue *aqueue)
void aqueue_clear(struct aqueue *aqueue);
/* Returns the number of items in aqueue. */
-unsigned int aqueue_count(const struct aqueue *aqueue);
+unsigned int aqueue_count(const struct aqueue *aqueue) ATTR_PURE;
More information about the dovecot-cvs
mailing list