-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The loop can be removed, the make cannot

On 03/24/2014 11:55 AM, DavidVorick wrote:
> In src/swarm/blockchain.go:
> 
>> return ok } + +func (b *Blockchain) AddRecord(r common.Record) { 
>> +	b.lock.Lock() +	defer b.lock.Unlock() +	b.pendingRecords =
>> append(b.pendingRecords) +} + +func (b *Blockchain) GetRecords()
>> []common.Record { +	b.lock.Lock() +	defer b.lock.Unlock() +	c :=
>> make([]common.Record, 0, len(b.pendingRecords)) +	for _, r :=
>> range b.pendingRecords { +		c = append(c, r) +	} +	return c
> 
> Why is this done using make() and a loop?
> 
> doesn't go have a copy() function that would work just as well?
> 
> — Reply to this email directly or view it on GitHub 
> <https://github.com/Siacoin/Sia/pull/49/files#r10890652>.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTMF8SAAoJEHP1nN3uZoHuCNIIAJmdLDBei1jNr270BZLPPcJK
N75VmCcQbTP+/Tu+4IyrnWB+o/ZA27yXi4wOhP9gZZoCu8bWjYkfQGUsfls8/hAH
Xhv6aY9zsF7dtY/gKhELCRCiMRxYONTON2pNIOhKEKeRF+rt3WTywBsSlPjX6O6T
Ap04WpxtkSIjcU1JxTP1WMhtBKzpLE9u8O3x+d00Xl+Laec2iivOD8mDxDfHMgUB
ROXJj0RmCh0b1S/yocpX9gDI2WqXJoeY2yHycV56jehQAWIRYRCZpz7Vcb9BeDjF
rhXqvUgSbLvkjyL2QTNihuezRWNLu0S4Iuc6wIErGjDCXBIdoJ4NI3FWcFxMTCY=
=ybhV
-----END PGP SIGNATURE-----