summaryrefslogtreecommitdiff
path: root/lib/depends.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-26 15:05:50 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-28 10:21:00 +0300
commit4d0345558534bbeda0b6e3ed960192e0b9bd11e1 (patch)
tree23c73eeef867cfc06654b7c3af059a214ca459ed /lib/depends.c
parent64b573d16682e61b134e287d74a18b22a669419b (diff)
downloadlibrpm-tizen-4d0345558534bbeda0b6e3ed960192e0b9bd11e1.tar.gz
librpm-tizen-4d0345558534bbeda0b6e3ed960192e0b9bd11e1.tar.bz2
librpm-tizen-4d0345558534bbeda0b6e3ed960192e0b9bd11e1.zip
Eliminate pointless alloca() of local DBT structs
Diffstat (limited to 'lib/depends.c')
-rw-r--r--lib/depends.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/depends.c b/lib/depends.c
index afc57dc3a..1738cee93 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -371,8 +371,8 @@ int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
*/
static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding)
{
- DBT * key = alloca(sizeof(*key));
- DBT * data = alloca(sizeof(*data));
+ DBT key;
+ DBT data;
rpmdbMatchIterator mi;
const char * Name;
Header h;
@@ -404,18 +404,18 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding)
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
- memset(key, 0, sizeof(*key));
- key->data = (void *) DNEVR;
- key->size = DNEVRlen;
- memset(data, 0, sizeof(*data));
- data->data = datap;
- data->size = datalen;
+ memset(&key, 0, sizeof(key));
+ key.data = (void *) DNEVR;
+ key.size = DNEVRlen;
+ memset(&data, 0, sizeof(data));
+ data.data = datap;
+ data.size = datalen;
/* FIX: data->data may be NULL */
- xx = dbiGet(dbi, dbcursor, key, data, DB_SET);
- DNEVR = key->data;
- DNEVRlen = key->size;
- datap = data->data;
- datalen = data->size;
+ xx = dbiGet(dbi, dbcursor, &key, &data, DB_SET);
+ DNEVR = key.data;
+ DNEVRlen = key.size;
+ datap = data.data;
+ datalen = data.size;
if (xx == 0 && datap && datalen == 4)
memcpy(&rc, datap, datalen);
@@ -529,14 +529,14 @@ exit:
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
- memset(key, 0, sizeof(*key));
- key->data = (void *) DNEVR;
- key->size = DNEVRlen;
- memset(data, 0, sizeof(*data));
- data->data = &rc;
- data->size = sizeof(rc);
+ memset(&key, 0, sizeof(key));
+ key.data = (void *) DNEVR;
+ key.size = DNEVRlen;
+ memset(&data, 0, sizeof(data));
+ data.data = &rc;
+ data.size = sizeof(rc);
- xx = dbiPut(dbi, dbcursor, key, data, 0);
+ xx = dbiPut(dbi, dbcursor, &key, &data, 0);
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
}
if (xx)