From: Josef 'Jeff' Sipek Date: Tue, 20 Sep 2016 12:51:29 +0000 (-0400) Subject: lib-storage: remove unused internal_attribute argument from attribute_{get,set} X-Git-Tag: 2.3.0.rc1~3000 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd6a8056771b6150685dea319ab5a94e021d17f1;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: remove unused internal_attribute argument from attribute_{get,set} This removes an argument added in 9f37ef2a9192e7d47e3d7ac959080fd01120f2e9 but obsoleted (but not removed) in d1147c225f64596fc5eeb1cb2aab31b3c57d5215. Not only does this change simplify the codebase, it actually brings the API closer to what it was back in 2.2. --- diff --git a/src/lib-storage/index/index-attribute.c b/src/lib-storage/index/index-attribute.c index 0f03e2411e..f7f6586411 100644 --- a/src/lib-storage/index/index-attribute.c +++ b/src/lib-storage/index/index-attribute.c @@ -191,8 +191,7 @@ index_storage_attribute_get_dict_trans(struct mailbox_transaction_context *t, int index_storage_attribute_set(struct mailbox_transaction_context *t, enum mail_attribute_type type, const char *key, - const struct mail_attribute_value *value, - bool unused ATTR_UNUSED) + const struct mail_attribute_value *value) { struct dict_transaction_context *dtrans; const char *mailbox_prefix; @@ -226,8 +225,7 @@ int index_storage_attribute_set(struct mailbox_transaction_context *t, int index_storage_attribute_get(struct mailbox *box, enum mail_attribute_type type, const char *key, - struct mail_attribute_value *value_r, - bool unused ATTR_UNUSED) + struct mail_attribute_value *value_r) { struct dict *dict; const char *mailbox_prefix, *error; diff --git a/src/lib-storage/index/index-storage.h b/src/lib-storage/index/index-storage.h index 0d8388fc51..62d106b3a2 100644 --- a/src/lib-storage/index/index-storage.h +++ b/src/lib-storage/index/index-storage.h @@ -113,12 +113,10 @@ int index_mailbox_get_physical_size(struct mailbox *box, int index_storage_attribute_set(struct mailbox_transaction_context *t, enum mail_attribute_type type, const char *key, - const struct mail_attribute_value *value, - bool unused); + const struct mail_attribute_value *value); int index_storage_attribute_get(struct mailbox *box, enum mail_attribute_type type, const char *key, - struct mail_attribute_value *value_r, - bool unused); + struct mail_attribute_value *value_r); struct mailbox_attribute_iter * index_storage_attribute_iter_init(struct mailbox *box, enum mail_attribute_type type, diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index daf0a6031c..bcf4c19a32 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -194,12 +194,10 @@ struct mailbox_vfuncs { int (*attribute_set)(struct mailbox_transaction_context *t, enum mail_attribute_type type, const char *key, - const struct mail_attribute_value *value, - bool internal_attribute); + const struct mail_attribute_value *value); int (*attribute_get)(struct mailbox *box, enum mail_attribute_type type, const char *key, - struct mail_attribute_value *value_r, - bool internal_attribute); + struct mail_attribute_value *value_r); struct mailbox_attribute_iter * (*attribute_iter_init)(struct mailbox *box, enum mail_attribute_type type, diff --git a/src/lib-storage/mailbox-attribute-internal.c b/src/lib-storage/mailbox-attribute-internal.c index a9bc788e85..f9a75afc35 100644 --- a/src/lib-storage/mailbox-attribute-internal.c +++ b/src/lib-storage/mailbox-attribute-internal.c @@ -13,8 +13,7 @@ static int mailbox_attribute_specialuse_get(struct mailbox *box, const char *key ATTR_UNUSED, - struct mail_attribute_value *value_r, - bool internal_attribute ATTR_UNUSED) + struct mail_attribute_value *value_r) { const struct mailbox_settings *set = box->set; @@ -39,8 +38,7 @@ iattr_mbox_prv_special_use = { static int mailbox_attribute_comment_get(struct mailbox *box, const char *key ATTR_UNUSED, - struct mail_attribute_value *value_r, - bool internal_attribute ATTR_UNUSED) + struct mail_attribute_value *value_r) { const struct mailbox_settings *set = box->set; @@ -77,8 +75,7 @@ iattr_mbox_shd_comment = { static int server_attribute_comment_get(struct mailbox *box, const char *key ATTR_UNUSED, - struct mail_attribute_value *value_r, - bool internal_attribute ATTR_UNUSED) + struct mail_attribute_value *value_r) { const struct mail_storage_settings *set = box->storage->set; @@ -103,8 +100,7 @@ iattr_serv_shd_comment = { static int server_attribute_admin_get(struct mailbox *box, const char *key ATTR_UNUSED, - struct mail_attribute_value *value_r, - bool internal_attribute ATTR_UNUSED) + struct mail_attribute_value *value_r) { const struct mail_storage_settings *set = box->storage->set; diff --git a/src/lib-storage/mailbox-attribute.c b/src/lib-storage/mailbox-attribute.c index 1249eb10ae..6d8e14d22f 100644 --- a/src/lib-storage/mailbox-attribute.c +++ b/src/lib-storage/mailbox-attribute.c @@ -174,7 +174,7 @@ mailbox_attribute_set_common(struct mailbox_transaction_context *t, case MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT: case MAIL_ATTRIBUTE_INTERNAL_RANK_OVERRIDE: /* notify about assignment */ - if (iattr->set != NULL && iattr->set(t, key, value, TRUE) < 0) + if (iattr->set != NULL && iattr->set(t, key, value) < 0) return -1; break; case MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY: @@ -185,13 +185,13 @@ mailbox_attribute_set_common(struct mailbox_transaction_context *t, return -1; } /* assign internal attribute */ - return iattr->set(t, key, value, TRUE); + return iattr->set(t, key, value); default: i_unreached(); } } - - ret = t->box->v.attribute_set(t, type, key, value, (iattr != NULL && iattr->rank != MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY)); + + ret = t->box->v.attribute_set(t, type, key, value); return ret; } @@ -265,16 +265,17 @@ mailbox_attribute_get_common(struct mailbox *box, if (iattr != NULL) { switch (iattr->rank) { case MAIL_ATTRIBUTE_INTERNAL_RANK_OVERRIDE: - if ((ret = iattr->get(box, key, value_r, TRUE)) != 0) { + if ((ret = iattr->get(box, key, value_r)) != 0) { if (ret < 0) return -1; value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY; return 1; } + break; case MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT: break; case MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY: - if ((ret = iattr->get(box, key, value_r, TRUE)) <= 0) + if ((ret = iattr->get(box, key, value_r)) <= 0) return ret; value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY; return 1; @@ -283,9 +284,7 @@ mailbox_attribute_get_common(struct mailbox *box, } } - bool internal_attribute = (iattr != NULL && iattr->rank != MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY); - - ret = box->v.attribute_get(box, type, key, value_r, internal_attribute); + ret = box->v.attribute_get(box, type, key, value_r); if (ret != 0) return ret; @@ -296,13 +295,14 @@ mailbox_attribute_get_common(struct mailbox *box, if (iattr->get == NULL) ret = 0; else { - if ((ret = iattr->get(box, key, value_r, internal_attribute)) < 0) + if ((ret = iattr->get(box, key, value_r)) < 0) return ret; } if (ret > 0) { value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY; return 1; } + break; case MAIL_ATTRIBUTE_INTERNAL_RANK_OVERRIDE: break; default: diff --git a/src/lib-storage/mailbox-attribute.h b/src/lib-storage/mailbox-attribute.h index 413dac634b..d7e8348867 100644 --- a/src/lib-storage/mailbox-attribute.h +++ b/src/lib-storage/mailbox-attribute.h @@ -245,10 +245,10 @@ struct mailbox_attribute_internal { /* Get the value of this internal attribute */ int (*get)(struct mailbox *box, const char *key, - struct mail_attribute_value *value_r, bool internal_attribute); - /* Set the value of this internal attribute */ + struct mail_attribute_value *value_r); + /* Set the value of this internal attribute */ int (*set)(struct mailbox_transaction_context *t, const char *key, - const struct mail_attribute_value *value, bool internal_attribute); + const struct mail_attribute_value *value); }; void mailbox_attribute_register_internal( diff --git a/src/plugins/acl/acl-attributes.c b/src/plugins/acl/acl-attributes.c index 7864975f21..d8aa13f094 100644 --- a/src/plugins/acl/acl-attributes.c +++ b/src/plugins/acl/acl-attributes.c @@ -136,8 +136,7 @@ static int acl_have_attribute_rights(struct mailbox *box) int acl_attribute_set(struct mailbox_transaction_context *t, enum mail_attribute_type type, const char *key, - const struct mail_attribute_value *value, - bool internal_attribute) + const struct mail_attribute_value *value) { struct acl_mailbox *abox = ACL_CONTEXT(t->box); @@ -146,13 +145,12 @@ int acl_attribute_set(struct mailbox_transaction_context *t, if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_ACL, strlen(MAILBOX_ATTRIBUTE_PREFIX_ACL)) == 0) return acl_attribute_update_acl(t, key, value); - return abox->module_ctx.super.attribute_set(t, type, key, value, internal_attribute); + return abox->module_ctx.super.attribute_set(t, type, key, value); } int acl_attribute_get(struct mailbox *box, enum mail_attribute_type type, const char *key, - struct mail_attribute_value *value_r, - bool internal_attribute) + struct mail_attribute_value *value_r) { struct acl_mailbox *abox = ACL_CONTEXT(box); @@ -161,7 +159,7 @@ int acl_attribute_get(struct mailbox *box, if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_ACL, strlen(MAILBOX_ATTRIBUTE_PREFIX_ACL)) == 0) return acl_attribute_get_acl(box, key, value_r); - return abox->module_ctx.super.attribute_get(box, type, key, value_r, internal_attribute); + return abox->module_ctx.super.attribute_get(box, type, key, value_r); } struct mailbox_attribute_iter * diff --git a/src/plugins/acl/acl-storage.h b/src/plugins/acl/acl-storage.h index 75fccb0de3..5f7df62172 100644 --- a/src/plugins/acl/acl-storage.h +++ b/src/plugins/acl/acl-storage.h @@ -33,12 +33,10 @@ int acl_mailbox_update_acl(struct mailbox_transaction_context *t, int acl_attribute_set(struct mailbox_transaction_context *t, enum mail_attribute_type type, const char *key, - const struct mail_attribute_value *value, - bool internal_attribute); + const struct mail_attribute_value *value); int acl_attribute_get(struct mailbox *box, enum mail_attribute_type type, const char *key, - struct mail_attribute_value *value_r, - bool internal_attribute); + struct mail_attribute_value *value_r); struct mailbox_attribute_iter * acl_attribute_iter_init(struct mailbox *box, enum mail_attribute_type type, const char *prefix);