From efe91c1c3799fc77b0747e84715eb784e2f4b80d Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 9 Jun 2011 11:33:38 +0300 Subject: [PATCH] Support set append in dbiCursorGetToSet() - If called with an existing set, results are appended. Otherwise return a newly allocated set. --- lib/rpmdb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/rpmdb.c b/lib/rpmdb.c index e86147b..56e2740 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -465,7 +465,15 @@ static int dbiCursorGetToSet(dbiCursor dbc, const char *keyp, size_t keylen, rc = dbiCursorGet(dbc, &key, &data, cflags); if (rc == 0) { - dbt2set(dbi, &data, set); + dbiIndexSet newset = NULL; + dbt2set(dbi, &data, &newset); + if (*set == NULL) { + *set = newset; + } else { + dbiAppendSet(*set, newset->recs, newset->count, + sizeof(*(newset->recs)), 0); + dbiIndexSetFree(newset); + } } else if (rc != DB_NOTFOUND) { rpmlog(RPMLOG_ERR, _("error(%d) getting \"%s\" records from %s index: %s\n"), -- 2.7.4