rpm/backport-ndb-drop-unused-number-of-allocated-slots.patch
2021-01-12 20:52:15 +08:00

39 lines
1.3 KiB
Diff

From 8e39098fa991b097ec0c746f0b4e3d8ab19a69ee Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Fri, 10 Jan 2020 11:45:52 +0100
Subject: [PATCH] ndb: drop unused number of allocated slots
This is not used as we re-read all slots everytime a package
is added or deleted.
URL:https://github.com/rpm-software-management/rpm/commit/8e39098fa991b097ec0c746f0b4e3d8ab19a69ee
---
lib/backend/ndb/rpmpkg.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/backend/ndb/rpmpkg.c b/lib/backend/ndb/rpmpkg.c
index eb65049..b613fa5 100644
--- a/lib/backend/ndb/rpmpkg.c
+++ b/lib/backend/ndb/rpmpkg.c
@@ -45,7 +45,6 @@ typedef struct rpmpkgdb_s {
unsigned int nextpkgidx;
struct pkgslot_s *slots;
- unsigned int aslots; /* allocated slots */
unsigned int nslots; /* used slots */
unsigned int *slothash;
@@ -256,8 +255,7 @@ static int rpmpkgReadSlots(rpmpkgdb pkgdb)
fileblks = stb.st_size / BLK_SIZE;
/* read (and somewhat verify) all slots */
- pkgdb->aslots = slotnpages * (PAGE_SIZE / SLOT_SIZE);
- pkgdb->slots = xcalloc(pkgdb->aslots, sizeof(*pkgdb->slots));
+ pkgdb->slots = xcalloc(slotnpages * (PAGE_SIZE / SLOT_SIZE), sizeof(*pkgdb->slots));
i = 0;
slot = pkgdb->slots;
minblkoff = slotnpages * (PAGE_SIZE / BLK_SIZE);
--
1.8.3.1