From dee00c2095fef1a3598821a6fddb92d72f55468a Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Fri, 1 Feb 2008 20:44:43 +0000 Subject: [PATCH] Small improvement of PDO offset calculation. --- master/domain.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/master/domain.c b/master/domain.c index 0a7525a5..59cef1cf 100644 --- a/master/domain.c +++ b/master/domain.c @@ -200,16 +200,15 @@ int ec_domain_reg_pdo_entry( // Calculate offset (in sync manager) for process data pointer bit_offset = 0; - byte_offset = 0; list_for_each_entry(other_pdo, &sync->pdos, list) { list_for_each_entry(other_entry, &other_pdo->entries, list) { - if (other_entry == entry) { - byte_offset = bit_offset / 8; - break; - } + if (other_entry == entry) + goto out; bit_offset += other_entry->bit_length; } } +out: + byte_offset = bit_offset / 8; // Allocate memory for data registration object if (!(data_reg =