Pool *pool;
Solvable *s;
- pool = (Pool *)sat_calloc(1, sizeof(*pool));
+ pool = (Pool *)solv_calloc(1, sizeof(*pool));
stringpool_init (&pool->ss, initpool_data);
/* alloc space for RelDep 0 */
- pool->rels = sat_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK);
+ pool->rels = solv_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK);
pool->nrels = 1;
memset(pool->rels, 0, sizeof(Reldep));
/* alloc space for Solvable 0 and system solvable */
- pool->solvables = sat_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK);
+ pool->solvables = solv_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK);
pool->nsolvables = 2;
memset(pool->solvables, 0, 2 * sizeof(Solvable));
+
+ /* initialize the system solvable */
s = pool->solvables + SYSTEMSOLVABLE;
s->name = SYSTEM_SYSTEM;
s->arch = ARCH_NOARCH;
queue_init(&pool->vendormap);
- pool->debugmask = SAT_DEBUG_RESULT; /* FIXME */
+ pool->debugmask = SOLV_DEBUG_RESULT; /* FIXME */
#ifdef FEDORA
pool->obsoleteusescolors = 1;
#endif
#ifdef DEBIAN
pool->allowselfconflicts = 1;
-# ifdef MULTI_SEMANTICS
pool->disttype = DISTTYPE_DEB;
-# endif
+#endif
+#ifdef RPM5
+ pool->obsoleteusesprovides = 1;
+ pool->implicitobsoleteusesprovides = 1;
#endif
return pool;
}
pool_freewhatprovides(pool);
pool_freeidhashes(pool);
- repo_freeallrepos(pool, 1);
- sat_free(pool->id2arch);
- sat_free(pool->solvables);
+ pool_freeallrepos(pool, 1);
+ solv_free(pool->id2arch);
+ solv_free(pool->id2color);
+ solv_free(pool->solvables);
stringpool_free(&pool->ss);
- sat_free(pool->rels);
+ solv_free(pool->rels);
+ pool_setvendorclasses(pool, 0);
queue_free(&pool->vendormap);
for (i = 0; i < POOL_TMPSPACEBUF; i++)
- sat_free(pool->tmpspacebuf[i]);
+ solv_free(pool->tmpspace.buf[i]);
for (i = 0; i < pool->nlanguages; i++)
free((char *)pool->languages[i]);
- sat_free(pool->languages);
- sat_free(pool->languagecache);
- sat_free(pool);
+ solv_free(pool->languages);
+ solv_free(pool->languagecache);
+ solv_free(pool);
+}
+
+void
+pool_freeallrepos(Pool *pool, int reuseids)
+{
+ int i;
+
+ pool_freewhatprovides(pool);
+ for (i = 1; i < pool->nrepos; i++)
+ if (pool->repos[i])
+ repo_freedata(pool->repos[i]);
+ pool->repos = solv_free(pool->repos);
+ pool->nrepos = 0;
+ pool->urepos = 0;
+ /* the first two solvables don't belong to a repo */
+ pool_free_solvable_block(pool, 2, pool->nsolvables - 2, reuseids);
}
#ifdef MULTI_SEMANTICS
Id
pool_add_solvable(Pool *pool)
{
- pool->solvables = sat_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK);
+ pool->solvables = solv_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK);
memset(pool->solvables + pool->nsolvables, 0, sizeof(Solvable));
return pool->nsolvables++;
}
Id nsolvables = pool->nsolvables;
if (!count)
return nsolvables;
- pool->solvables = sat_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK);
+ pool->solvables = solv_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK);
memset(pool->solvables + nsolvables, 0, sizeof(Solvable) * count);
pool->nsolvables += count;
return nsolvables;
if (pool->ss.nstrings < 3)
return;
- sorted = sat_malloc2(pool->ss.nstrings, sizeof(Id));
+ sorted = solv_malloc2(pool->ss.nstrings, sizeof(Id));
for (id = 0; id < pool->ss.nstrings; id++)
sorted[id] = id;
- sat_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool);
+ solv_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool);
last = 0;
lastid = 0;
for (i = 1; i < pool->ss.nstrings; i++)
last = pool->whatprovidesdata + o;
lastid = id;
}
- sat_free(sorted);
+ solv_free(sorted);
dp = pool->whatprovidesdata + 2;
for (id = 1; id < pool->ss.nstrings; id++)
{
;
}
o = dp - pool->whatprovidesdata;
- POOL_DEBUG(SAT_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o);
if (pool->whatprovidesdataoff == o)
return;
r = pool->whatprovidesdataoff - o;
pool->whatprovidesdataoff = o;
- pool->whatprovidesdata = sat_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id));
+ pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id));
if (r > pool->whatprovidesdataleft)
r = pool->whatprovidesdataleft;
memset(pool->whatprovidesdata + o, 0, r * sizeof(Id));
Repo *installed = pool->installed;
unsigned int now;
- now = sat_timems(0);
- POOL_DEBUG(SAT_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables);
- POOL_DEBUG(SAT_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels);
+ now = solv_timems(0);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels);
pool_freeidhashes(pool); /* XXX: should not be here! */
pool_freewhatprovides(pool);
num = pool->ss.nstrings;
- pool->whatprovides = whatprovides = sat_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK);
- pool->whatprovides_rel = sat_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK);
+ pool->whatprovides = whatprovides = solv_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK);
+ pool->whatprovides_rel = solv_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK);
/* count providers for each name */
for (i = pool->nsolvables - 1; i > 0; i--)
np++; /* inc # of provider 'slots' for stats */
}
- POOL_DEBUG(SAT_DEBUG_STATS, "provide ids: %d\n", np);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "provide ids: %d\n", np);
/* reserve some space for relation data */
extra = 2 * pool->nrels;
if (extra < 256)
extra = 256;
- POOL_DEBUG(SAT_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra);
/* alloc space for all providers + extra */
- whatprovidesdata = sat_calloc(off + extra, sizeof(Id));
+ whatprovidesdata = solv_calloc(off + extra, sizeof(Id));
/* now fill data for all provides */
for (i = pool->nsolvables - 1; i > 0; i--)
pool->whatprovidesdataoff = off;
pool->whatprovidesdataleft = extra;
pool_shrink_whatprovides(pool);
- POOL_DEBUG(SAT_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id)));
- POOL_DEBUG(SAT_DEBUG_STATS, "createwhatprovides took %d ms\n", sat_timems(now));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id)));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "createwhatprovides took %d ms\n", solv_timems(now));
}
/*
void
pool_freewhatprovides(Pool *pool)
{
- pool->whatprovides = sat_free(pool->whatprovides);
- pool->whatprovides_rel = sat_free(pool->whatprovides_rel);
- pool->whatprovidesdata = sat_free(pool->whatprovidesdata);
+ pool->whatprovides = solv_free(pool->whatprovides);
+ pool->whatprovides_rel = solv_free(pool->whatprovides_rel);
+ pool->whatprovidesdata = solv_free(pool->whatprovidesdata);
pool->whatprovidesdataoff = 0;
pool->whatprovidesdataleft = 0;
}
/* extend whatprovidesdata if needed, +1 for ID_NULL-termination */
if (pool->whatprovidesdataleft < count + 1)
{
- POOL_DEBUG(SAT_DEBUG_STATS, "growing provides hash data...\n");
- pool->whatprovidesdata = sat_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "growing provides hash data...\n");
+ pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id));
pool->whatprovidesdataleft = count + 4096;
}
return 1;
if (flags != 2 && flags != 5)
flags ^= 5;
- if ((flags & (1 << (1 + evrcmp(pool, s->evr, evr, EVRCMP_DEPCMP)))) != 0)
+ if ((flags & (1 << (1 + pool_evrcmp(pool, s->evr, evr, EVRCMP_DEPCMP)))) != 0)
return 1;
return 0;
}
else
{
int f = flags == 5 ? 5 : flags == 2 ? pflags : (flags ^ 5) & (pflags | 5);
- if ((f & (1 << (1 + evrcmp(pool, pevr, evr, EVRCMP_DEPCMP)))) != 0)
+ if ((f & (1 << (1 + pool_evrcmp(pool, pevr, evr, EVRCMP_DEPCMP)))) != 0)
return 1;
}
return 0;
{
/* simple version comparison relation */
#if 0
- POOL_DEBUG(SAT_DEBUG_STATS, "addrelproviders: what provides %s?\n", dep2str(pool, name));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: what provides %s?\n", pool_dep2str(pool, name));
#endif
pp = pool_whatprovides_ptr(pool, name);
while (ISRELDEP(name))
{
if (pid == name)
{
-#if defined(MULTI_SEMANTICS)
if (pool->disttype == DISTTYPE_DEB)
- continue;
- else
- break;
-#elif defined(DEBIAN_SEMANTICS)
- continue; /* unversioned provides can
- * never match versioned deps */
-#else
- break; /* yes, provides all versions */
-#endif
+ continue; /* unversioned provides can never match versioned deps */
+ break;
}
if (!ISRELDEP(pid))
continue; /* wrong provides name */
queue_push(&plist, p);
}
/* make our system solvable provide all unknown rpmlib() stuff */
- if (plist.count == 0 && !strncmp(id2str(pool, name), "rpmlib(", 7))
+ if (plist.count == 0 && !strncmp(pool_id2str(pool, name), "rpmlib(", 7))
queue_push(&plist, SYSTEMSOLVABLE);
}
/* add providers to whatprovides */
#if 0
- POOL_DEBUG(SAT_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d);
#endif
pool->whatprovides_rel[d] = pool_queuetowhatprovides(pool, &plist);
queue_free(&plist);
va_list args;
char buf[1024];
- if ((type & (SAT_FATAL|SAT_ERROR)) == 0)
+ if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0)
{
if ((pool->debugmask & type) == 0)
return;
va_start(args, format);
if (!pool->debugcallback)
{
- if ((type & (SAT_FATAL|SAT_ERROR)) == 0 && !(pool->debugmask & SAT_DEBUG_TO_STDERR))
+ if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0 && !(pool->debugmask & SOLV_DEBUG_TO_STDERR))
vprintf(format, args);
else
vfprintf(stderr, format, args);
void
pool_setdebuglevel(Pool *pool, int level)
{
- int mask = SAT_DEBUG_RESULT;
+ int mask = SOLV_DEBUG_RESULT;
if (level > 0)
- mask |= SAT_DEBUG_STATS|SAT_DEBUG_ANALYZE|SAT_DEBUG_UNSOLVABLE|SAT_DEBUG_SOLVER|SAT_DEBUG_TRANSACTION;
+ mask |= SOLV_DEBUG_STATS|SOLV_DEBUG_ANALYZE|SOLV_DEBUG_UNSOLVABLE|SOLV_DEBUG_SOLVER|SOLV_DEBUG_TRANSACTION;
if (level > 1)
- mask |= SAT_DEBUG_JOB|SAT_DEBUG_SOLUTIONS|SAT_DEBUG_POLICY;
+ mask |= SOLV_DEBUG_JOB|SOLV_DEBUG_SOLUTIONS|SOLV_DEBUG_POLICY;
if (level > 2)
- mask |= SAT_DEBUG_PROPAGATE;
+ mask |= SOLV_DEBUG_PROPAGATE;
if (level > 3)
- mask |= SAT_DEBUG_RULE_CREATION;
- if (level > 4)
- mask |= SAT_DEBUG_SCHUBI;
- mask |= pool->debugmask & SAT_DEBUG_TO_STDERR; /* keep bit */
+ mask |= SOLV_DEBUG_RULE_CREATION;
+ mask |= pool->debugmask & SOLV_DEBUG_TO_STDERR; /* keep bit */
+ pool->debugmask = mask;
+}
+
+void pool_setdebugcallback(Pool *pool, void (*debugcallback)(struct _Pool *, void *data, int type, const char *str), void *debugcallbackdata)
+{
+ pool->debugcallback = debugcallback;
+ pool->debugcallbackdata = debugcallbackdata;
+}
+
+void pool_setdebugmask(Pool *pool, int mask)
+{
pool->debugmask = mask;
}
+void pool_setloadcallback(Pool *pool, int (*cb)(struct _Pool *, struct _Repodata *, void *), void *loadcbdata)
+{
+ pool->loadcallback = cb;
+ pool->loadcallbackdata = loadcbdata;
+}
+
/*************************************************************************/
struct searchfiles {
if (MAPTST(&csf->seen, dep))
continue;
MAPSET(&csf->seen, dep);
- s = id2str(pool, dep);
+ s = pool_id2str(pool, dep);
if (*s != '/')
continue;
- csf->ids = sat_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK);
- csf->dirs = sat_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK);
- csf->names = sat_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK);
+ csf->ids = solv_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK);
+ csf->dirs = solv_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK);
+ csf->names = solv_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK);
csf->ids[csf->nfiles] = dep;
sr = strrchr(s, '/');
- csf->names[csf->nfiles] = strdup(sr + 1);
- csf->dirs[csf->nfiles] = sat_malloc(sr - s + 1);
+ csf->names[csf->nfiles] = solv_strdup(sr + 1);
+ csf->dirs[csf->nfiles] = solv_malloc(sr - s + 1);
if (sr != s)
strncpy(csf->dirs[csf->nfiles], s, sr - s);
csf->dirs[csf->nfiles][sr - s] = 0;
Map donemap;
int ndone, incomplete;
- if (!pool->nrepos)
+ if (!pool->urepos)
return;
cbd->nfiles = sf->nfiles;
cbd->ids = sf->ids;
cbd->dirs = sf->dirs;
cbd->names = sf->names;
- cbd->dids = sat_realloc2(cbd->dids, sf->nfiles, sizeof(Id));
+ cbd->dids = solv_realloc2(cbd->dids, sf->nfiles, sizeof(Id));
map_init(&cbd->providedids, pool->ss.nstrings);
- repoid = 0;
- repo = repoonly ? repoonly : pool->repos[0];
+ repoid = 1;
+ repo = repoonly ? repoonly : pool->repos[repoid];
map_init(&donemap, pool->nsolvables);
queue_init(&fileprovidesq);
provstart = provend = 0;
for (;;)
{
- if (repo->disabled)
+ if (!repo || repo->disabled)
{
if (repoonly || ++repoid == pool->nrepos)
break;
continue;
}
ndone = 0;
- for (data = repo->repodata, repodataid = 0; repodataid < repo->nrepodata; repodataid++, data++)
+ FOR_REPODATAS(repo, repodataid, data)
{
if (ndone >= repo->nsolvables)
break;
{
#if 0
for (i = 0; i < cbd->nfiles; i++)
- if (!MAPTST(&cbd->providedids, cbd->ids[i]) && !repodata_filelistfilter_matches(data, id2str(pool, cbd->ids[i])))
- printf("need complete filelist because of %s\n", id2str(pool, cbd->ids[i]));
+ if (!MAPTST(&cbd->providedids, cbd->ids[i]) && !repodata_filelistfilter_matches(data, pool_id2str(pool, cbd->ids[i])))
+ printf("need complete filelist because of %s\n", pool_id2str(pool, cbd->ids[i]));
#endif
for (i = 0; i < cbd->nfiles; i++)
- if (!MAPTST(&cbd->providedids, cbd->ids[i]) && !repodata_filelistfilter_matches(data, id2str(pool, cbd->ids[i])))
+ if (!MAPTST(&cbd->providedids, cbd->ids[i]) && !repodata_filelistfilter_matches(data, pool_id2str(pool, cbd->ids[i])))
break;
if (i < cbd->nfiles)
incomplete = 1;
}
void
-pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp)
+pool_addfileprovides_queue(Pool *pool, Queue *idq)
{
Solvable *s;
- Repo *repo;
+ Repo *installed, *repo;
struct searchfiles sf, isf, *isfp;
struct addfileprovides_cbdata cbd;
int i;
unsigned int now;
- now = sat_timems(0);
+ installed = pool->installed;
+ now = solv_timems(0);
memset(&sf, 0, sizeof(sf));
map_init(&sf.seen, pool->ss.nstrings + pool->nrels);
memset(&isf, 0, sizeof(isf));
map_init(&isf.seen, pool->ss.nstrings + pool->nrels);
+ if (idq)
+ queue_empty(idq);
isfp = installed ? &isf : 0;
for (i = 1, s = pool->solvables + i; i < pool->nsolvables; i++, s++)
{
}
map_free(&sf.seen);
map_free(&isf.seen);
- POOL_DEBUG(SAT_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles);
+ POOL_DEBUG(SOLV_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles);
cbd.dids = 0;
- if (idp)
- *idp = 0;
if (sf.nfiles)
{
#if 0
for (i = 0; i < sf.nfiles; i++)
- POOL_DEBUG(SAT_DEBUG_STATS, "looking up %s in filelist\n", id2str(pool, sf.ids[i]));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i]));
#endif
pool_addfileprovides_search(pool, &cbd, &sf, 0);
- if (idp)
- {
- sf.ids = sat_extend(sf.ids, sf.nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK);
- sf.ids[sf.nfiles] = 0;
- *idp = sf.ids;
- sf.ids = 0;
- }
- sat_free(sf.ids);
+ if (idq)
+ for (i = 0; i < sf.nfiles; i++)
+ queue_push(idq, sf.ids[i]);
+ solv_free(sf.ids);
for (i = 0; i < sf.nfiles; i++)
{
- sat_free(sf.dirs[i]);
- sat_free(sf.names[i]);
+ solv_free(sf.dirs[i]);
+ solv_free(sf.names[i]);
}
- sat_free(sf.dirs);
- sat_free(sf.names);
+ solv_free(sf.dirs);
+ solv_free(sf.names);
}
if (isf.nfiles)
{
#if 0
for (i = 0; i < isf.nfiles; i++)
- POOL_DEBUG(SAT_DEBUG_STATS, "looking up %s in installed filelist\n", id2str(pool, isf.ids[i]));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in installed filelist\n", pool_id2str(pool, isf.ids[i]));
#endif
if (installed)
pool_addfileprovides_search(pool, &cbd, &isf, installed);
- sat_free(isf.ids);
+ solv_free(isf.ids);
for (i = 0; i < isf.nfiles; i++)
{
- sat_free(isf.dirs[i]);
- sat_free(isf.names[i]);
+ solv_free(isf.dirs[i]);
+ solv_free(isf.names[i]);
}
- sat_free(isf.dirs);
- sat_free(isf.names);
+ solv_free(isf.dirs);
+ solv_free(isf.names);
}
- sat_free(cbd.dids);
+ solv_free(cbd.dids);
pool_freewhatprovides(pool); /* as we have added provides */
- POOL_DEBUG(SAT_DEBUG_STATS, "addfileprovides took %d ms\n", sat_timems(now));
+ POOL_DEBUG(SOLV_DEBUG_STATS, "addfileprovides took %d ms\n", solv_timems(now));
}
void
pool_addfileprovides(Pool *pool)
{
- pool_addfileprovides_ids(pool, pool->installed, 0);
+ pool_addfileprovides_queue(pool, 0);
}
void
{
int i;
- pool->languagecache = sat_free(pool->languagecache);
+ pool->languagecache = solv_free(pool->languagecache);
pool->languagecacheother = 0;
if (pool->nlanguages)
{
pool->nlanguages = nlanguages;
if (!nlanguages)
return;
- pool->languages = sat_calloc(nlanguages, sizeof(const char **));
+ pool->languages = solv_calloc(nlanguages, sizeof(const char **));
for (i = 0; i < pool->nlanguages; i++)
- pool->languages[i] = strdup(languages[i]);
+ pool->languages[i] = solv_strdup(languages[i]);
}
Id
char buf[256], *p;
int l;
- if (!lang)
+ if (!lang || !*lang)
return id;
- n = id2str(pool, id);
+ n = pool_id2str(pool, id);
l = strlen(n) + strlen(lang) + 2;
if (l > sizeof(buf))
- p = sat_malloc(strlen(n) + strlen(lang) + 2);
+ p = solv_malloc(strlen(n) + strlen(lang) + 2);
else
p = buf;
sprintf(p, "%s:%s", n, lang);
- id = str2id(pool, p, create);
+ id = pool_str2id(pool, p, create);
if (p != buf)
free(p);
return id;
char *
pool_alloctmpspace(Pool *pool, int len)
{
- int n = pool->tmpspacen;
+ int n = pool->tmpspace.n;
if (!len)
return 0;
- if (len > pool->tmpspacelen[n])
+ if (len > pool->tmpspace.len[n])
{
- pool->tmpspacebuf[n] = sat_realloc(pool->tmpspacebuf[n], len + 32);
- pool->tmpspacelen[n] = len + 32;
+ pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32);
+ pool->tmpspace.len[n] = len + 32;
}
- pool->tmpspacen = (n + 1) % POOL_TMPSPACEBUF;
- return pool->tmpspacebuf[n];
+ pool->tmpspace.n = (n + 1) % POOL_TMPSPACEBUF;
+ return pool->tmpspace.buf[n];
}
static char *
if (space)
{
int n, oldn;
- n = oldn = pool->tmpspacen;
+ n = oldn = pool->tmpspace.n;
for (;;)
{
if (!n--)
n = POOL_TMPSPACEBUF - 1;
if (n == oldn)
break;
- if (pool->tmpspacebuf[n] != space)
+ if (pool->tmpspace.buf[n] != space)
continue;
- if (len > pool->tmpspacelen[n])
+ if (len > pool->tmpspace.len[n])
{
- pool->tmpspacebuf[n] = sat_realloc(pool->tmpspacebuf[n], len + 32);
- pool->tmpspacelen[n] = len + 32;
+ pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32);
+ pool->tmpspace.len[n] = len + 32;
}
- return pool->tmpspacebuf[n];
+ return pool->tmpspace.buf[n];
}
}
return 0;
void
pool_freetmpspace(Pool *pool, const char *space)
{
- int n = pool->tmpspacen;
+ int n = pool->tmpspace.n;
if (!space)
return;
n = (n + (POOL_TMPSPACEBUF - 1)) % POOL_TMPSPACEBUF;
- if (pool->tmpspacebuf[n] == space)
- pool->tmpspacen = n;
+ if (pool->tmpspace.buf[n] == space)
+ pool->tmpspace.n = n;
}
char *
if (!len)
return "";
s = pool_alloctmpspace(pool, 2 * len + 1);
- sat_bin2hex(buf, len, s);
+ solv_bin2hex(buf, len, s);
return s;
}
struct mptree *mptree;
/* create map from dir to mptree */
- cbd->dirmap = sat_free(cbd->dirmap);
+ cbd->dirmap = solv_free(cbd->dirmap);
cbd->nmap = 0;
- dirmap = sat_calloc(data->dirpool.ndirs, sizeof(Id));
+ dirmap = solv_calloc(data->dirpool.ndirs, sizeof(Id));
mptree = cbd->mptree;
mp = 0;
for (dn = 2, dirs = data->dirpool.dirs + dn; dn < data->dirpool.ndirs; dn++)
if (data->localpool)
compstr = stringpool_id2str(&data->spool, comp);
else
- compstr = id2str(data->repo->pool, comp);
+ compstr = pool_id2str(data->repo->pool, comp);
compl = strlen(compstr);
for (i = mptree[mp].child; i; i = mptree[i].sibling)
if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
cbd.nmap = 0;
cbd.olddata = 0;
- mptree = sat_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK);
+ mptree = solv_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK);
/* our root node */
mptree[0].sibling = 0;
if (!i)
{
/* create new node */
- mptree = sat_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK);
+ mptree = solv_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK);
i = nmptree++;
mptree[i].sibling = mptree[pos].child;
mptree[i].child = 0;
}
if (ignoredu.map)
map_free(&ignoredu);
- sat_free(cbd.dirmap);
- sat_free(mptree);
+ solv_free(cbd.dirmap);
+ solv_free(mptree);
}
int
unsigned char *map;
Solvable *s;
- map = sat_calloc(pool->nsolvables, 1);
+ map = solv_calloc(pool->nsolvables, 1);
for (p = 1; p < pool->nsolvables; p++)
{
if (!MAPTST(installedmap, p))
{
int ispatch = 0; /* see solver.c patch handling */
- if (!strncmp("patch:", id2str(pool, s->name), 6))
+ if (!strncmp("patch:", pool_id2str(pool, s->name), 6))
ispatch = 1;
conp = s->repo->idarraydata + s->conflicts;
while ((con = *conp++) != 0)
p = conflicts->elements[i + 1];
md5 = conflicts->elements[i + 2];
q = conflicts->elements[i + 3];
- id = rel2id(pool, fn, md5, REL_FILECONFLICT, 1);
+ id = pool_rel2id(pool, fn, md5, REL_FILECONFLICT, 1);
s = pool->solvables + p;
if (!s->repo)
continue;