From: Aki Tuomi Date: Tue, 16 Aug 2016 10:44:27 +0000 (+0300) Subject: lib-index: Do not do pointless memmove X-Git-Tag: 2.3.0.rc1~3141 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9ee2f9fb3ef7b9391bfeeff1b374aead51667aa;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Do not do pointless memmove Makes static analysers happier, since moving the data when days is 0 or days is 8 is effectively non-op. --- diff --git a/src/lib-index/mail-index-transaction-update.c b/src/lib-index/mail-index-transaction-update.c index 5b151ebca6..38678f446b 100644 --- a/src/lib-index/mail-index-transaction-update.c +++ b/src/lib-index/mail-index-transaction-update.c @@ -146,8 +146,9 @@ void mail_index_update_day_headers(struct mail_index_transaction *t) /* @UNSAFE: move days forward and fill the missing days with old day_first_uid[0]. */ - memmove(hdr.day_first_uid + days, hdr.day_first_uid, - (max_days - days) * sizeof(hdr.day_first_uid[0])); + if (days > 1 && days < max_days) + memmove(hdr.day_first_uid + days, hdr.day_first_uid, + (max_days - days) * sizeof(hdr.day_first_uid[0])); for (i = 1; i < days; i++) hdr.day_first_uid[i] = hdr.day_first_uid[0];