This is an automated email from Gerrit. "Marek Vrbka <marek.vr...@codasip.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7735
-- gerrit commit 5e51bfcb603123bf8ed3d8c248978d802c3cbd2d Author: Marek Vrbka <marek.vr...@codasip.com> Date: Tue Jun 6 15:32:09 2023 +0200 register: refactor register_cache_invalidate() refactor_cache_invalidate() is written a way which uses pointer arithmetic, which makes it harder to read. This patch replaces it with more readable way to iterate over array of structs. Change-Id: Ia420f70a3bb6998c690c8c600c71301dca9f9dbf Signed-off-by: Marek Vrbka <marek.vr...@codasip.com> diff --git a/src/target/register.c b/src/target/register.c index 2287125863..c5b8274c2f 100644 --- a/src/target/register.c +++ b/src/target/register.c @@ -93,9 +93,8 @@ void register_unlink_cache(struct reg_cache **cache_p, const struct reg_cache *c /** Marks the contents of the register cache as invalid (and clean). */ void register_cache_invalidate(struct reg_cache *cache) { - struct reg *reg = cache->reg_list; - - for (unsigned int n = cache->num_regs; n != 0; n--, reg++) { + for (size_t n = 0; n < cache->num_regs; n++) { + struct reg *reg = &cache->reg_list[n]; if (!reg->exist) continue; reg->valid = false; --