Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_sync.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2019-12-24 10:28:11 -0500
committerAllan McRae <allan@archlinux.org>2020-01-07 11:40:32 +1000
commit9883015be2b2010ad541fd02b6856bfdb28fb35d (patch)
treecea21e7bc4eab89a47356f60c4b924ae3043bb42 /lib/libalpm/be_sync.c
parentffb69c700abd6eb3b86e79e09b135029ff9104b4 (diff)
Use c99 struct initialization to avoid memset calls
This is guaranteed less error prone than calling memset and hoping the human gets the argument order correct.
Diffstat (limited to 'lib/libalpm/be_sync.c')
-rw-r--r--lib/libalpm/be_sync.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 2c76fe83..07d2b4ae 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 = {0};
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,
{
const char *entryname, *filename;
alpm_pkg_t *pkg;
- struct archive_read_buffer buf;
+ struct archive_read_buffer buf = {0};
entryname = archive_entry_pathname(entry);
if(entryname == NULL) {
@@ -613,7 +611,6 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data from archive entry %s\n",
entryname);
- memset(&buf, 0, sizeof(buf));
/* 512K for a line length seems reasonable */
buf.max_line_size = 512 * 1024;