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

brainpower brainpower at mailbox.org
Fri Dec 27 14:06:24 UTC 2019


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,


-- 
regards,
brainpower

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20191227/df97209d/attachment.sig>


More information about the pacman-dev mailing list