Browse Source

Remove duplicate counter in read_io_status()

Stéphane Raimbault 16 years ago
parent
commit
bec7d24f54
1 changed files with 1 additions and 3 deletions
  1. 1 3
      modbus/modbus.c

+ 1 - 3
modbus/modbus.c

@@ -978,7 +978,6 @@ static int read_io_status(modbus_param_t *mb_param, int slave, int function,
         if (ret > 0) {
                 int i, temp, bit;
                 int pos = 0;
-                int processed = 0;
                 int offset;
                 int offset_length;
 
@@ -993,9 +992,8 @@ static int read_io_status(modbus_param_t *mb_param, int slave, int function,
                         /* Shift reg hi_byte to temp */
                         temp = response[3 + i];
                         
-                        for (bit = 0x01; (bit & 0xff) && (processed < nb);) {
+                        for (bit = 0x01; (bit & 0xff) && (pos < nb);) {
                                 data_dest[pos++] = (temp & bit) ? TRUE : FALSE;
-                                processed++;
                                 bit = bit << 1;
                         }