[pacman-dev] [PATCH 2/2] Use c99 struct initialization to avoid memset calls

Allan McRae allan at archlinux.org
Mon Jan 6 03:32:28 UTC 2020


On 28/12/19 12:06 am, brainpower wrote:
> Am 25.12.19 um 00:17 schrieb Dave Reisner:
>> diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
>> index 2c76fe83..4614610c 100644
>> --- a/lib/libalpm/be_sync.c
>> +++ b/lib/libalpm/be_sync.c
>> @@ -219,12 +219,10 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
>>  
>>  	for(i = db->servers; i; i = i->next) {
>>  		const char *server = i->data, *final_db_url = NULL;
>> -		struct dload_payload payload;
>> +		struct dload_payload payload = {};
> 
> Hi,
> you seem to have missed a 0 to make it {0} here, right?
> 
>>  		size_t len;
>>  		int sig_ret = 0;
>>  
>> -		memset(&payload, 0, sizeof(struct dload_payload));
>> -
>>  		/* set hard upper limit of 25MiB */
>>  		payload.max_size = 25 * 1024 * 1024;
>>  
>> @@ -601,7 +599,7 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
> 
> 

Thanks - this has been corrected.

A


More information about the pacman-dev mailing list