summaryrefslogtreecommitdiff
path: root/Perl-RPM
diff options
context:
space:
mode:
authorrjray <devnull@localhost>2001-03-08 06:11:20 +0000
committerrjray <devnull@localhost>2001-03-08 06:11:20 +0000
commitdbf468af61aeff91f88b9da98ee6e4bb8027f166 (patch)
tree2d9f2f5ed3fbefcbb2097cbe79e6c2436ba3f4fb /Perl-RPM
parent487fac0d286bf572ebca0541ba9d673fde01b739 (diff)
downloadrpm-dbf468af61aeff91f88b9da98ee6e4bb8027f166.tar.gz
rpm-dbf468af61aeff91f88b9da98ee6e4bb8027f166.tar.bz2
rpm-dbf468af61aeff91f88b9da98ee6e4bb8027f166.zip
Fixed rpm 4.0 issue
CVS patchset: 4612 CVS date: 2001/03/08 06:11:20
Diffstat (limited to 'Perl-RPM')
-rw-r--r--Perl-RPM/RPM/Database.xs17
1 files changed, 11 insertions, 6 deletions
diff --git a/Perl-RPM/RPM/Database.xs b/Perl-RPM/RPM/Database.xs
index 3c6128c7d..766e7860c 100644
--- a/Perl-RPM/RPM/Database.xs
+++ b/Perl-RPM/RPM/Database.xs
@@ -5,7 +5,7 @@
#include <fcntl.h>
#include "RPM.h"
-static char * const rcsid = "$Id: Database.xs,v 1.12 2001/02/27 07:34:44 rjray Exp $";
+static char * const rcsid = "$Id: Database.xs,v 1.13 2001/03/08 06:11:20 rjray Exp $";
/*
rpmdb_TIEHASH
@@ -88,6 +88,8 @@ SV* rpmdb_FETCH(pTHX_ RPM__Database self, SV* key)
Header hdr; /* For rpmdbGetRecord() calls */
#if RPM_MAJOR >= 4
rpmdbMatchIterator mi;
+#else
+ int result;
#endif
SV** svp;
SV* FETCH;
@@ -103,8 +105,6 @@ SV* rpmdb_FETCH(pTHX_ RPM__Database self, SV* key)
allow the request to be by name -or- by an offset number */
if (SvPOK(key))
{
- int result;
-
name = SvPV(key, namelen);
/* Step 1: Check to see if this has already been requested and is
@@ -125,11 +125,9 @@ SV* rpmdb_FETCH(pTHX_ RPM__Database self, SV* key)
/* Run the search */
result = rpmdbFindPackage(dbstruct->dbp, name, dbstruct->index_set);
if (result)
- {
/* Some sort of error occured when reading the DB or the
name was not found. */
return &PL_sv_undef;
- }
else
{
/* There may have been more than one match, but for now
@@ -148,6 +146,7 @@ SV* rpmdb_FETCH(pTHX_ RPM__Database self, SV* key)
}
#else
/* This is the 4.0 way */
+ offset = -1;
mi = rpmdbInitIterator(dbstruct->dbp, RPMTAG_NAME, name, 0);
while ((hdr = rpmdbNextIterator(mi)) != NULL)
{
@@ -155,6 +154,10 @@ SV* rpmdb_FETCH(pTHX_ RPM__Database self, SV* key)
break;
}
rpmdbFreeIterator(mi);
+ if (offset == -1)
+ /* Some sort of error occured when reading the DB or the
+ name was not found. */
+ return &PL_sv_undef;
#endif
}
else if (SvIOK(key))
@@ -328,10 +331,12 @@ AV* rpmdb_find_by_whatever(pTHX_ RPM__Database self, SV* string, int idx)
const char* str = NULL; /* For the actual string out of (SV *)string */
RPM_Database* dbstruct; /* This is the struct used to hold C-level data */
AV* return_val;
- int result, loop;
+ int loop;
SV* tmp_hdr;
#if RPM_MAJOR >= 4
rpmdbMatchIterator mi;
+#else
+ int result;
#endif
/* Any successful operation will store items on this */