diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2012-02-01 23:14:29 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2012-02-01 23:18:25 +0100 |
commit | 7f7ea759ebdc854beb0468b410f7d2382f291a4f (patch) | |
tree | 079e608f706706609d7fb95b81c485cc548a8396 /decoders/i2cdemux | |
parent | 156509ca42f0df2380c9f205f9aad337e1a07802 (diff) | |
download | libsigrokdecode-7f7ea759ebdc854beb0468b410f7d2382f291a4f.tar.gz libsigrokdecode-7f7ea759ebdc854beb0468b410f7d2382f291a4f.zip |
srd: Properly use append() for appending to lists.
This is not only the canonical way to do it, it's also quite a bit faster
and less memory-intensive than using '+='.
Diffstat (limited to 'decoders/i2cdemux')
-rw-r--r-- | decoders/i2cdemux/i2cdemux.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/decoders/i2cdemux/i2cdemux.py b/decoders/i2cdemux/i2cdemux.py index a597188..c4c0d3b 100644 --- a/decoders/i2cdemux/i2cdemux.py +++ b/decoders/i2cdemux/i2cdemux.py @@ -60,7 +60,7 @@ class Decoder(srd.Decoder): cmd, databyte, ack = data # Add the I2C packet to our local cache. - self.packets += [[ss, es, data]] + self.packets.append([ss, es, data]) if cmd in ('ADDRESS READ', 'ADDRESS WRITE'): if databyte in self.slaves: @@ -68,9 +68,9 @@ class Decoder(srd.Decoder): return # We're never seen this slave, add a new stream. - self.slaves += [databyte] - self.out_proto += [self.add(srd.OUTPUT_PROTO, - 'i2c-%s' % hex(databyte))] + self.slaves.append(databyte) + self.out_proto.append(self.add(srd.OUTPUT_PROTO, + 'i2c-%s' % hex(databyte))) self.stream = self.streamcount self.streamcount += 1 elif cmd == 'STOP': |