Mailinglist Archive: zypp-commit (606 mails)

< Previous Next >
[zypp-commit] r9477 - in /trunk/sat-solver/src: repo.h repodata.c
  • From: matz@xxxxxxxxxxxxxxxx
  • Date: Wed, 09 Apr 2008 09:03:34 -0000
  • Message-id: <20080409090334.A3F8827098@xxxxxxxxxxxxxxxx>
Author: matz
Date: Wed Apr 9 11:03:34 2008
New Revision: 9477

URL: http://svn.opensuse.org/viewcvs/zypp?rev=9477&view=rev
Log:
Make dataiterator_match available.

Modified:
trunk/sat-solver/src/repo.h
trunk/sat-solver/src/repodata.c

Modified: trunk/sat-solver/src/repo.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.h?rev=9477&r1=9476&r2=9477&view=diff
==============================================================================
--- trunk/sat-solver/src/repo.h (original)
+++ trunk/sat-solver/src/repo.h Wed Apr 9 11:03:34 2008
@@ -198,6 +198,7 @@
void dataiterator_init(Dataiterator *di, Repo *repo, Id p, Id keyname,
const char *match, int flags);
int dataiterator_step(Dataiterator *di);
+int dataiterator_match(Dataiterator *di, int flags, const void *match);
void dataiterator_skip_attribute(Dataiterator *di);
void dataiterator_skip_solvable(Dataiterator *di);
void dataiterator_skip_repo(Dataiterator *di);

Modified: trunk/sat-solver/src/repodata.c
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repodata.c?rev=9477&r1=9476&r2=9477&view=diff
==============================================================================
--- trunk/sat-solver/src/repodata.c (original)
+++ trunk/sat-solver/src/repodata.c Wed Apr 9 11:03:34 2008
@@ -678,10 +678,10 @@

/* FIXME factor and merge with repo_matchvalue */
static int
-dataiterator_match(Dataiterator *di, KeyValue *kv)
+dataiterator_match_int_real(Dataiterator *di, int flags, const void *vmatch)
{
- int flags = di->flags;
-
+ KeyValue *kv = &di->kv;
+ const char *match = vmatch;
if ((flags & SEARCH_STRINGMASK) != 0)
{
switch (di->key->type)
@@ -703,34 +703,34 @@
case SEARCH_SUBSTRING:
if (flags & SEARCH_NOCASE)
{
- if (!strcasestr(kv->str, di->match))
+ if (!strcasestr(kv->str, match))
return 0;
}
else
{
- if (!strstr(kv->str, di->match))
+ if (!strstr(kv->str, match))
return 0;
}
break;
case SEARCH_STRING:
if (flags & SEARCH_NOCASE)
{
- if (strcasecmp(di->match, kv->str))
+ if (strcasecmp(match, kv->str))
return 0;
}
else
{
- if (strcmp(di->match, kv->str))
+ if (strcmp(match, kv->str))
return 0;
}
break;
case SEARCH_GLOB:
- if (fnmatch(di->match, kv->str, (flags & SEARCH_NOCASE) ?
FNM_CASEFOLD : 0))
+ if (fnmatch(match, kv->str, (flags & SEARCH_NOCASE) ? FNM_CASEFOLD
: 0))
return 0;
break;
#if 0
case SEARCH_REGEX:
- if (regexec(&di->regexp, kv->str, 0, NULL, 0))
+ if (regexec((const regex_t *)vmatch, kv->str, 0, NULL, 0))
return 0;
#endif
default:
@@ -740,6 +740,18 @@
return 1;
}

+static int
+dataiterator_match_int(Dataiterator *di)
+{
+ return dataiterator_match_int_real(di, di->flags, di->match);
+}
+
+int
+dataiterator_match(Dataiterator *di, int flags, const void *vmatch)
+{
+ return dataiterator_match_int_real(di, flags, vmatch);
+}
+
static Repokey solvablekeys[RPM_RPMDBID - SOLVABLE_NAME + 1] = {
{ SOLVABLE_NAME, REPOKEY_TYPE_ID, 0, KEY_STORAGE_SOLVABLE },
{ SOLVABLE_ARCH, REPOKEY_TYPE_ID, 0, KEY_STORAGE_SOLVABLE },
@@ -947,7 +959,7 @@
}
weg2:
if (!di->match
- || dataiterator_match(di, &di->kv))
+ || dataiterator_match_int(di))
break;
}
return 1;

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages